Flexbox Header Demo
How do I make an flexbox header demo?
This is a pen to help demonstrate the power of flexbox by building a header using flex instead of floats.. What is a flexbox header demo? How do you make a flexbox header demo? This script and codes were developed by Andy McFee on 09 August 2022, Tuesday.
Flexbox Header Demo - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Flexbox Header Demo</title> <script src="http://s.codepen.io/assets/libs/modernizr.js" type="text/javascript"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <header> <a href="#" class="header--logo">Logo</a> <ul class="header--nav"> <li class="nav--about"><a href="#">About</a></li> <li class="nav--faq"><a href="#">FAQ</a></li> <li class="nav--contact"><a href="#">Contact</a></li> <li class="nav--login"><a href="#">Login</a></li> </ul>
</header> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
</body>
</html>
Flexbox Header Demo - Script Codes CSS Codes
* { box-sizing: border-box;
}
html { font-size: 16px;
}
header { width: 100%; background-color: #4095bf; padding: 1.5rem; font-size: 1.25rem; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-orient: horizontal; -webkit-box-direction: normal; -ms-flex-direction: row; flex-direction: row;
}
a { text-decoration: none; color: white;
}
ul { margin: 0; padding: 0; list-style: none; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-orient: horizontal; -webkit-box-direction: normal; -ms-flex-direction: row; flex-direction: row;
}
ul li { padding: 0 1rem;
}
.header--logo { -webkit-box-flex: 1; -ms-flex: 1 0 auto; flex: 1 0 auto; -webkit-box-ordinal-group: 11; -ms-flex-order: 10; order: 10;
}
.header--nav { -webkit-box-flex: 0; -ms-flex: 0 1 auto; flex: 0 1 auto; -webkit-box-ordinal-group: 21; -ms-flex-order: 20; order: 20;
}
.nav--about { -webkit-box-ordinal-group: 11; -ms-flex-order: 10; order: 10;
}
.nav--faq { -webkit-box-ordinal-group: 21; -ms-flex-order: 20; order: 20;
}
.nav--contact { -webkit-box-ordinal-group: 31; -ms-flex-order: 30; order: 30;
}
.nav--login { -webkit-box-ordinal-group: 41; -ms-flex-order: 40; order: 40;
}
/*// Sizing
.header--nav { flex: 1 0 400px; li { background: rgba(red, .4); } li:nth-child(odd) { background: rgba(green, .4); }
}
// Growing and Shrinking
.nav--about { flex: 1 0 auto; }
.nav--faq { flex: 1 0 auto; }
.nav--contact { flex: 1 0 auto; }
.nav--login { flex: 1 0 auto; }*/
Developer | Andy McFee |
Username | andymcfee |
Uploaded | August 09, 2022 |
Rating | 3 |
Size | 2,618 Kb |
Views | 48,576 |
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 |
BEM Flexbox Nav build for a workshop | 3,126 Kb |
CSS Loading Spinners | 3,969 Kb |
Responsive Boxes with Images | 3,915 Kb |
Responsive Web App Panel Layout | 5,055 Kb |
Flip Card | 4,615 Kb |
Whatsizeisthisscreen.com | 4,413 Kb |
Flexbox vertcially centered nav text | 4,011 Kb |
Responsive Boxes with CSS3 Columns | 4,168 Kb |
Flip Card - Bad Rotation | 4,440 Kb |
Round Music Player with Official.fm API | 6,473 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 |
Animation | B3ST1156 | 1,584 Kb |
Canvas Orbital Trails v2 | Jackrugile | 3,421 Kb |
Wikipedia viewer | Chpecson | 2,865 Kb |
TigerWoods Freecodecamp Page | Baileytj | 2,869 Kb |
Mondrian | Chrisarmstrong | 2,787 Kb |
Simple Accordion | Wearebold | 3,683 Kb |
Bootstrap Responsive Menu Drawer | JesseGlacken | 3,777 Kb |
Sticky div | Kaslab | 2,225 Kb |
Flexbox slider | Rendro | 3,459 Kb |
Twitch API | Coderpilot | 3,412 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!