r/css • • 16h ago

Article GitHub Ditches CSS-in-JS for CSS Modules, Reports 55% Faster SSR after Three-Year Migration

Thumbnail
infoq.com
73 Upvotes

r/css • • 13h ago

Help How do I do a mobile menu that you can toggle with CSS?

7 Upvotes

https://itsaneve.neocities.org/home

I'm trying to get my website to work for mobile and the navigation is really not working for me. The bar on top doesn't look nice on the small screen, so I've been trying to make a navigation icon that you can toggle to bring up a side menu. I found a method for it with CSS (the checkbox method https://css-tricks.com/the-checkbox-hack/ ) but I can't get it to work for me! Does anyone know what I'm doing wrong?

This is my default CSS

#nav-box{
 width:100vw;
 height: 50px;
 background-color:#282147;/*darker purple*/
 margin-top:-75px;
 margin-left:-10px;
 padding:5px 0;
 position:fixed;
 font-size:20px;
 z-index:1000;
}

 #nav-box ul{
    float:right;
   }
 
 #nav-box li{
   margin-top:-15px;
   }

#nav-box a{
   color:#fbfcde;
   text-decoration:none;
  }

This is my CSS in a media query (the problem zone)

#nav-box{
 font-size:1.5em; 
 position:fixed;
 margin:0;
 white-space: nowrap;
 height:60px;
  }

#mobile-nav{
  background:url(https://itsaneve.neocities.org/Portfolio/imgs/burger%20menu.png);
  background-size:contain;
  width:35px;
  height:40px;
  float:right;
  padding:10px;
  margin-right:10px;
  z-index:1000;
  padding:5px;
  }

#nav-list{
  opacity:0.0;
  width:50vw;
  height:100vh;
  position:relative;
  background-color:#282147;
  overflow:visible;
  top:40px;
  right:-50px;
  padding:5px;
  }

#nav-check:checked ~ #nav-list{
  opacity:1.0;
  }

This is my html

<header>
  <section id="nav-box">
   <nav>  <label for="nav-check" id="mobile-nav"><input type="checkbox" id="nav-check"></label>
    <ul id="nav-list">
    <li class="current">Home</li>
    <li><a href="wip.html" id="wip-pg-nav">Escape!</a></li>
     <li> <a href="index.html">Animation</a></li>
     <li> <a href="illu.html">Still Art</a></li>
     <li> <a href="boardin.html">Storyboards</a></li>
     <li><a href="abt.html">About Me</a></li>
    
    </ul>
   </nav>
  </section>
 </header>I'm trying to get my website to work for mobile and the navigation is really not working for me. The bar on top doesn't look nice on the small screen, so I've been trying to make a navigation icon that you can toggle to bring up a side menu. I found a method for it with CSS (the checkbox method https://css-tricks.com/the-checkbox-hack/ ) but I can't get it to work for me! Does anyone know what I'm doing wrong?This is my default CSS#nav-box{
 width:100vw;
 height: 50px;
 background-color:#282147;/*darker purple*/
 margin-top:-75px;
 margin-left:-10px;
 padding:5px 0;
 position:fixed;
 font-size:20px;
 z-index:1000;
}

 #nav-box ul{
    float:right;
   }
 
 #nav-box li{
   margin-top:-15px;
   }

#nav-box a{
   color:#fbfcde;
   text-decoration:none;
  }This is my CSS in a media query (the problem zone)#nav-box{
 font-size:1.5em; 
 position:fixed;
 margin:0;
 white-space: nowrap;
 height:60px;
  }

#mobile-nav{
  background:url(https://itsaneve.neocities.org/Portfolio/imgs/burger%20menu.png);
  background-size:contain;
  width:35px;
  height:40px;
  float:right;
  padding:10px;
  margin-right:10px;
  z-index:1000;
  padding:5px;
  }

#nav-list{
  opacity:0.0;
  width:50vw;
  height:100vh;
  position:relative;
  background-color:#282147;
  overflow:visible;
  top:40px;
  right:-50px;
  padding:5px;
  }

#nav-check:checked ~ #nav-list{
  opacity:1.0;
  }This is my html<header>
  <section id="nav-box">
   <nav>  <label for="nav-check" id="mobile-nav"><input type="checkbox" id="nav-check"></label>
    <ul id="nav-list">
    <li class="current">Home</li>
    <li><a href="wip.html" id="wip-pg-nav">Escape!</a></li>
     <li> <a href="index.html">Animation</a></li>
     <li> <a href="illu.html">Still Art</a></li>
     <li> <a href="boardin.html">Storyboards</a></li>
     <li><a href="abt.html">About Me</a></li>
    
    </ul>
   </nav>
  </section>
 </header>

r/css • • 20h ago

Article Issues are open, Looking for contributors.Brickbox - A lightweight no dependency 2d to 3d css converter.

Post image
2 Upvotes

r/css • • 58m ago

AI Assisted Does anyone know how to fix this so that I can make it fit properly on every screen?

Thumbnail justenq.github.io
0 Upvotes

Heres the github page with the code: https://github.com/JustenQ/The-Holy-Trinity-Triangle-Tool

This was my first attempt at coding something, partially using AI years ago when it sucked at coding and then going in and bug fixing/rewriting things, so many beginner mistakes were made. The one thing that I was never quite able to get right was having the layout properly fit every screen without rearanging the layout. I tried doing the viewport dimensions but it was never quite right.