DEV Community

Alex Carpenter
Alex Carpenter

Posted on

5 1

Build conditional layouts with CSS Flexbox

If you enjoyed this screencast, consider subscribing to my YouTube channel for more screencasts about HTML, CSS, and JavaScript.

Top comments (2)

Collapse
 
jrock2004 profile image
John Costanzo

Another way you can do this with a little less CSS, is on the .main__content. Remove the width property and just have flex: 1. Now if the sidebar is hidden, it will just take up the room you wanted.

Collapse
 
hybrid_alex profile image
Alex Carpenter

Definitely, you can see here that I make that recommendation youtu.be/OkcUU_G-wVU?t=396

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay