JSFiddle - React, Tailwind, and code Playground
by webvitaly
HTML
<nav role='navigation' class="main-nav" id="main-nav">
<ul id="main-nav-list">
<li> <a href="#">
<div>
Home
<span>is where the heart is</span>
</div>
</a>
</li>
<li> <a href="#">
<div>
About
<span>to blow this popcicle stand</span>
</div>
</a>
</li>
<li> <a href="#">
<div>
Clients
<span>are beautiful people</span>
</div>
</a>
</li>
<li> <a href="#">
<div>
Contact
<span>your mom she misses you</span>
</div>
</a>
</li>
</ul>
</nav>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" width="100px" height="100px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve" class="dont-render-dawg">
<defs>
<path id="leaf" d="M51.151-1.011c0,0-32.454,50.827-32.454,71.676c0,20.857,17.35,27.692,32.454,27.692
c15.099,0,33.121-8.644,33.121-27.692C84.272,51.621,51.151-1.011,51.151-1.011z...
SCSS
* {
box-sizing: border-box;
}
html {
font-size: 12px;
}
.dont-render-dawg {
position: absolute;
height: 0;
width: 0;
}
.main-nav {
background: #eee;
ul {
margin: 0;
padding: 0;
display: flex;
flex-wrap: wrap;
justify-content: center;
list-style: none;
}
a {
padding: 1.25rem 0.5rem;
font-size: 1.6rem;
max-width: 140px;
font-weight: bold;
text-decoration: none;
display: flex;
align-items: flex-start;
color: #333;
background: #ffa;
outline: 1px solid rgba(red, 0.5);
&:hover, &:focus {
background: #ccc;
color: black;
svg {
fill: green;
}
span {
color: black;
}
}
}
span {
display: block;
font-size: 1rem;
font-weight: normal;
color: #888;
margin: 0.25rem 0 0 0;
}
.icon {
width: 40px;
height: 40px;
float: left;
margin-right: 1rem;
fill: #999;
}
}
.options {
text-align: center;
padding: 2rem 0;
select {
margin-right: 2rem;
}
}
@media (min-width: 1000px) {
.main-nav {
a {
max-width: 500px;
font-size: 2rem;
}
.icon {
width: 25px;
height: 25px;
}
}
}
JavaScript
$("#menu-items-position").on("change", function (e) {
$("#main-nav-list").css("justify-content", $(this).find("option:selected").val());
});
$("#menu-items").on("change", function (e) {
$("#main-nav-list li").css("flex", $(this).find("option:selected").val());
});