Flexbox Header Demo

Developer
Size
2,618 Kb
Views
48,576

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 Previews

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; }*/
Flexbox Header Demo - Script Codes
Flexbox Header Demo - Script Codes
Home Page Home
Developer Andy McFee
Username andymcfee
Uploaded August 09, 2022
Rating 3
Size 2,618 Kb
Views 48,576
Do you need developer help for Flexbox Header Demo?

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!

Andy McFee (andymcfee) Script Codes
Create amazing blog posts 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!