Order-changing Sidebar
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 - 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; }
}
Developer | Keith Wyland |
Username | keithwyland |
Uploaded | September 13, 2022 |
Rating | 3.5 |
Size | 4,100 Kb |
Views | 24,288 |
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!
Name | Size |
Full Width Areas With Sidebar | 2,709 Kb |
Collapse | 1,854 Kb |
Downward spiral | 2,105 Kb |
Tunnel | 1,983 Kb |
Testing a Sass Mixin | 2,291 Kb |
Clock Concept | 3,693 Kb |
SO example | 2,195 Kb |
CSS Fan Blades or Flower | 1,934 Kb |
Test bpopup ipad bug | 7,924 Kb |
Radio Button A11y Q | 3,521 Kb |
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!
Name | Username | Size |
Gulpfile | Aimhigherwebdesign-amy | 1,765 Kb |
Personal Website Redesign v2.0 | DevItWithDavid | 5,168 Kb |
Shape Outside - Polygon | Stacy | 3,954 Kb |
CSS3 keyframe onload animation. | Samueljseay | 1,706 Kb |
Rrremark.com Overlay Highlighter | Derickruiz | 4,438 Kb |
Electric worm | Jeffibacache | 2,377 Kb |
Text Looping Transition | Agelber | 5,619 Kb |
CSS3 Selectables with information rollover | Jasonmayes | 9,565 Kb |
Wikipedia API | Coderpilot | 2,802 Kb |
Scroll effect with text with help from Skrollr | Luxonglassing | 2,935 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!