I have created the nav bar for my page but it does not support multiple screens how can I make it support them?
HTM:
<section id="container">
<section id="header"> <span id="icon">Icon</span>
<input type="text" name="search_box" id="search_box">
<nav id="dropdown_menu">
<ul>
<li>dropdown
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
</li>
</ul>
</nav>
<div class="vertical_bar" style="float: right; margin-right: 3%;"></div>
<div id="notifications"> <span id="num_notifs">4</span>
L</div>
<nav id="menu">
<ul>
<li>Home</li>
<li>Office</li>
</ul>
</nav> <span id="logo">Website Name</span>
</section>
</section>
CSS:
#container {
width: 100 % ;
height: 100 % ;
font-family: sans-serif !important;
}
#header {
height: 5%;
width: 100%;
background-color: black;
color: white;
}
#header span, div, input, nav {
display: inline-block;
vertical-align: middle;
box-sizing: border-box;
margin: 1%;
}
#header#search_box {
margin: 0.5% 10%;
background-image: url(../img/search_icon.png);
background-repeat: no-repeat;
background-size: 20px 20px;
}
#header#logo {
float: right;
margin-right: 7%;
margin-top: 1%;
}
#header#menu {
float: right;
margin-right: 7%;
margin-top: 1%;
}
#header#menu ul li {
display: inline;
margin: 5px;
}
#notifications {
float: right;
margin-right: 7%;
margin - top: 0.5%;
border: 2px solid white;
border-radius: 50%;
width: 20px;
height: 20px;
font-weight: bold;
text-align: center;
padding: 2px;
position: relative;
}
#notifications#num_notifs {
font-size: small;
position: absolute;
top: 0;
left: 80%;
background-color: red;
border-radius: 50%;
width: 15px;
height: 15px;
}
#header#dropdown_menu {
float: right;
margin-right: 2%;
margin-top: 1%;
text-align: center;
}
#header#dropdown_menu ul li: hover ul {
display: block;
}
#header#dropdown_menu ul li ul {
display: none;
}
#header#dropdown_menu ul li ul li: FIRST-CHILD {
margin-top: 10px;
}
#header#dropdown_menu ul li ul li {
margin-bottom: 10px;
}
By multiple screens, you mean screen resolutions/dimensions, right? Or are you referring to browsers? You are going to want to check out media queries, these are used to target different screen sizes..
These are the media queries I use for my site, I followed the twitter bootstrap setup seen here:
CSS
Just place your CSS into each query, and you it should work well..
Be sure to place this in your head though, this will eliminate problems with retina display:
EDIT: Media queries are supported by all mobile devices, reference here.
However, IE 6-8 do not support them.. a quick fix to this problem is to use the following below you stylesheet:
This is a poly-fill that will allow IE6-8 to use media queries..