Order-changing Sidebar

Developer
Size
4,100 Kb
Views
24,288

How do I make an order-changing sidebar?

Flexbox is used here on small/mobile size to display the items in a different order than source order.. What is a order-changing sidebar? How do you make a order-changing sidebar? This script and codes were developed by Keith Wyland on 13 September 2022, Tuesday.

Order-changing Sidebar Previews

Order-changing Sidebar - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Order-changing Sidebar</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ * { box-sizing: border-box;
}
body { background: #BBC8F2;
}
.cf:before,
.cf:after { content: " "; display: table;
}
.cf:after { clear: both;
}
.page-wrap { max-width: 1024px; margin: 0 auto; color: #044D8C; line-height: 1.3;
}
.container { display: flex; flex-direction: column; background: #0487D9; overflow: hidden;
}
@media (min-width: 700px) { .container { display: block; }
}
.side { background: #0487D9; padding: 1em; order: 0; position: relative; color: #BBC8F2;
}
.side + .side { border-top: 2px solid white; order: 1;
}
.side:before { position: absolute; content: ''; height: 100%; border-left: 2px solid #044D8C; left: -2px; top: 0;
}
@media (min-width: 700px) { .side { float: right; width: 25%; clear: right; }
}
.main { padding: 1em; background: white; order: 1; position: relative;
}
.main:after { position: absolute; content: ''; height: 300%; width: 100%; background: white; left: 0; top: 100%; z-index: 0;
}
@media (min-width: 700px) { .main { width: 75%; border-right: 2px solid #044D8C; float: left; }
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <div class="page-wrap">
<div class="container cf"> <div class="main"> <h1>Order-changing Sidebar</h1> <h2><em>Mixing Flexbox and Floats? An abomination!!</em></h2> <p>Flexbox is used here on small/mobile size to display the items in a different order than source order.</p> <p>Floats are used on larger/desktop size to make the items form a sidebar.</p> <p>It also uses some pseudo-element and overflow trickery to fake the same-height columns for the floats. Go ahead, add way more content to this main area, or add another sidebar item. I <em>dare</em> you. (Ok, but don't get, like, carried away with it, maybe.)</p> <h3>Why??</h3> <p>Basically, flexbox itself was not cutting it for design needs here. Unless I'm clueless and there's a way. In that case: PLEASE SHARE! (Note: solution <em>must</em> allow for any quantity of sidebar items and no known or fixed height of said items)</p> <h3>More Content</h3> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Alias eaque non, eveniet aspernatur porro, culpa adipisci nulla, facilis error animi enim. Sunt laboriosam debitis ipsam doloribus, mollitia eveniet commodi, unde.</p> </div> <div class="side"> <h2>Sidebar item 1</h2> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam incidunt, et ipsum veritatis at. Fugit quibusdam dicta necessitatibus tempore recusandae alias, porro dolores officiis et aperiam ad, doloremque doloribus nam.</p> </div> <div class="side"> <h2>Sidebar item 2</h2> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Vero nisi nulla, odio obcaecati rerum itaque magni quas repudiandae quos, fuga autem aliquam reprehenderit mollitia sunt nihil sint assumenda maxime corporis.</p> </div> <div class="side"> <h2>Sidebar item 3</h2> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolorum sunt voluptate earum facilis placeat repudiandae ipsa nostrum eum impedit cumque non, odio, atque deleniti amet quae dolorem minus consequuntur debitis.</p> </div>
</div>
</div>
</body>
</html>

Order-changing Sidebar - Script Codes CSS Codes

* { box-sizing: border-box;
}
body { background: #BBC8F2;
}
.cf:before,
.cf:after { content: " "; display: table;
}
.cf:after { clear: both;
}
.page-wrap { max-width: 1024px; margin: 0 auto; color: #044D8C; line-height: 1.3;
}
.container { display: flex; flex-direction: column; background: #0487D9; overflow: hidden;
}
@media (min-width: 700px) { .container { display: block; }
}
.side { background: #0487D9; padding: 1em; order: 0; position: relative; color: #BBC8F2;
}
.side + .side { border-top: 2px solid white; order: 1;
}
.side:before { position: absolute; content: ''; height: 100%; border-left: 2px solid #044D8C; left: -2px; top: 0;
}
@media (min-width: 700px) { .side { float: right; width: 25%; clear: right; }
}
.main { padding: 1em; background: white; order: 1; position: relative;
}
.main:after { position: absolute; content: ''; height: 300%; width: 100%; background: white; left: 0; top: 100%; z-index: 0;
}
@media (min-width: 700px) { .main { width: 75%; border-right: 2px solid #044D8C; float: left; }
}
Order-changing Sidebar - Script Codes
Order-changing Sidebar - Script Codes
Home Page Home
Developer Keith Wyland
Username keithwyland
Uploaded September 13, 2022
Rating 3.5
Size 4,100 Kb
Views 24,288
Do you need developer help for Order-changing Sidebar?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Keith Wyland (keithwyland) Script Codes
Create amazing web content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!