Please help! Everything in my menu works as I want except this one issue. My third level nested list items are overlaying on the second level and I can't fix it. I have tried everything I can think of, but I am beating my head against a brick wall here.
If someone could please take a look at this code example and help figure out what I am doing wrong it would be greatly appreciated.
I really don't want to have to start from scratch as I like the look and feel of the menu.
Here is my code:
/*navigation*/
nav.primary {
width: 960px;
height: 30px;
font-family: "Source Sans Pro", sans-serif;
font-weight: 400;
position: absolute;
top: 123px;
left: 50%;
margin-left: -34.25em;
border-bottom: #F26621 solid 3px;
z-index: 9999;
}
nav.primary ul, nav.primary ul li { margin: 0px; }
nav.primary select { display: none; }
nav.primary ul li {
display: block;
float: left;
position: relative;
}
nav.primary ul li a {
display: block;
line-height: 28px;
padding: 0 25px;
color: #444;
text-decoration: none;
font-size: 16px;
font-weight: 500;
background: none;
letter-spacing: 0.06em;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
}
nav.primary ul li a:hover {
background: #F26621;
color: #FFF;
cursor: pointer;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
}
/*sub menu*/
nav.primary ul li ul {
position: absolute;
top: 100%;
left: 0px;
z-index: 998;
opacity: 0.6;
max-height: 0px;
overflow: hidden;
width: auto;
min-width: 188px;
transition: max-height .25s ease-in-out .125s;
-moz-transition: max-height .25s ease-in-out .125s;
-webkit-transition: max-height .25s ease-in-out .125s;
-webkit-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
}
nav.primary ul li span { display: none; }
nav.primary ul li:hover ul {
z-index: 999;
height: auto;
max-height: 200px;
opacity: 1;
transition-delay: 0s;
-moz-transition-delay: 0s;
-webkit-transition-delay: 0s;
}
nav.primary ul ul li {
display: block;
float: left;
width: auto;
min-width: 188px;
display: block;
background: #F26621;
border-bottom: 1px solid #999;
}
nav.primary ul ul li a {
display: block;
line-height: 32px;
padding: 0 14px;
font-size: 14px;
letter-spacing: 0.03em;
text-transform: none;
color: #FFF;
border-radius: 0px;
-moz-border-radius: 0px;
-webkit-border-radius: 0px;
transition: background .25s ease 0s;
-moz-transition: background .25s ease 0s;
-webkit-transition: background .25s ease 0s;
}
nav.primary ul ul li a:hover {
background: #F98C58;
border: none;
border-radius: 0px;
-moz-border-radius: 0px;
-webkit-border-radius: 0px;
transition: background .25s ease 0s;
-moz-transition: background .25s ease 0s;
-webkit-transition: background .25s ease 0s;
}
nav.primary ul li:hover > a {
background: #F26621;
color: #FFF;
}
/*third level menu*/
nav.primary ul ul li ul {
position: absolute;
top: 100%;
left: 0px;
z-index: 998;
opacity: 0.6;
max-height: 0px;
overflow: visible;
width: auto;
min-width: 188px;
transition: max-height .25s ease-in-out .125s;
-moz-transition: max-height .25s ease-in-out .125s;
-webkit-transition: max-height .25s ease-in-out .125s;
-webkit-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
}
nav.primary ul ul ul li {
float: none;
width: auto;
display: block;
background: #999;
border-bottom: 1px solid #F26621;
}
nav.primary ul ul ul li a {
display: block;
width: auto;
min-width: 188px;
line-height: 32px;
background: #999;
padding: 0 14px 0 28px;
font-size: 12px;
letter-spacing: 0.03em;
text-transform: none;
color: #FFF;
border-radius: 0px;
-moz-border-radius: 0px;
-webkit-border-radius: 0px;
transition: background .25s ease 0s;
-moz-transition: background .25s ease 0s;
-webkit-transition: background .25s ease 0s;
}
nav.primary ul ul ul li a:hover {
background: #F98C58;
border: none;
border-radius: 0px;
-moz-border-radius: 0px;
-webkit-border-radius: 0px;
transition: background .25s ease 0s;
-moz-transition: background .25s ease 0s;
-webkit-transition: background .25s ease 0s;
}
<nav role="navigation" class="primary clearfix">
<ul>
<li class="selected">
Home
</li>
<li>
About Us
<ul>
<li>
Management Team
</li>
<li>
Board of Directors
</li>
<li>
History
</li>
<li>
Collaborations
</li>
<li>
Business Development
</li>
<li>
Contact Us
</li>
</ul>
</li>
<li>
R & D
<ul>
<li>
Pipeline
<ul>
<li>
Ampion
</li>
<li>
Optina
</li>
<li>
NCE001
</li>
</ul>
</li>
<li>
Disease Education
</li>
<li>
Non-core Assets
</li>
</ul>
</li>
<li>
Newsroom
<ul>
<li>
Media
</li>
</ul>
</li>
<li>
Investor Relations
<ul>
<li>
Sec Filings
</li>
<li>
Corporate Governance
</li>
<li>
Stock Information
</li>
<li>
Events & Presentations
</li>
<li>
Investor FAQ
</li>
<li>
Email Alerts
</li>
</ul>
</li>
<li>
Sitemap
</li>
</ul>
<select id="pageParentID" name="pageParentID" class="nav">
<option value="" selected="selected">Go to...</option>
<option value="/zone/">Home</option>
<option value="/zone/about-us.php">About Us</option>
<option value="/zone/management-team.php"> - Management Team</option>
<option value="/zone/board-of-directors.php"> - Board of Directors</option>
<option value="/zone/history.php"> - History</option>
<option value="/zone/collaborations.php"> - Collaborations</option>
<option value="/zone/business-development.php"> - Business Development</option>
<option value="/zone/contact-us.php"> - Contact Us</option>
<option value="/zone/r-d.php">R & D</option>
<option value="/zone/pipeline.php"> - Pipeline</option>
<option value="/zone/ampion.php"> - Ampion</option>
<option value="/zone/optina.php"> - Optina</option>
<option value="/zone/nce001.php"> - NCE001</option>
<option value="/zone/disease-education.php"> - Disease Education</option>
<option value="/zone/non-core-assets.php"> - Non-core Assets</option>
<option value="/zone/newsroom/">Newsroom</option>
<option value="/zone/media.php"> - Media</option>
<option value="/zone/investor-relations.php">Investor Relations</option>
<option value="/zone/sec-filings.php"> - Sec Filings</option>
<option value="/zone/corporate-governance.php"> - Corporate Governance</option>
<option value="/zone/stock-information.php"> - Stock Information</option>
<option value="/zone/events-presentations.php"> - Events & Presentations</option>
<option value="/zone/investor-faq.php"> - Investor FAQ</option>
<option value="/zone/email-alerts.php"> - Email Alerts</option>
<option value="/zone/sitemap.php">Sitemap</option>
</select>
</nav>
I've got it most of the way there. The main issue you had was that you needed to set
display: none;
to the 3rd level nav.
The working changes are in this fiddle
Related
Hello please I need some help with making a child sub-menu to be visible when I mouse hover on the "Accesorii Gaming", its child sub-menu is:
Ochelari VR Gaming
Gamepad / Controler
Volane
Casti Console
Streaming
and it should be visible on hover. I am doing a CSS battle here and I think I am loosing it...
Thank you for your support
HTML + CSS3 is here: https://codepen.io/tosasilviu/pen/vYBMWyM
or below...
* {
margin: 0;
padding: 0;
}
li {
list-style: none;
}
.font-produse-h {
font-family: "Bungee";
font-size: 45px;
text-shadow: 3px 3px 0px #08b870;
color: #000;
margin: 50px 0 20px 50px;
}
/* Menu Container */
.navigation {
display: inline-block;
position: relative;
z-index: 10;
margin-left: 50px;
}
/* Menu List */
.navigation > li {
display: block;
float: left;
}
/* Menu Links */
.navigation > li > a {
position: relative;
display: block;
z-index: 20;
width: 130px;
height: 54px;
padding: 0 20px;
line-height: 54px;
font-family: "Quicksand";
font-weight: bold;
font-size: 15px;
color: #fcfcfc;
text-shadow: 0 0 1px rgba(0, 0, 0, 0.35);
background: #08b870;
border-left: 1px solid #06e187;
text-align: center;
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
-o-transition: all 0.3s ease;
-ms-transition: all 0.3s ease;
transition: all 0.3s ease;
}
.navigation > li:hover > a {
background: #0b8452;
}
.navigation > li:first-child > a {
border-radius: 6px 0px 0px 6px;
border-left: 0px;
}
.navigation > li:last-child > a {
border-radius: 0px 6px 6px 0px;
}
/* Menu Dropdown */
.navigation > li > div {
position: absolute;
display: block;
color: #fff;
width: 170px;
top: 50px;
opacity: 0;
visibility: hidden;
overflow: hidden;
background: #0b8452;
border-radius: 0 0 3px 3px;
-webkit-transition: all 0.3s ease 0.15s;
-moz-transition: all 0.3s ease 0.15s;
-o-transition: all 0.3s ease 0.15s;
-ms-transition: all 0.3s ease 0.15s;
transition: all 0.3s ease 0.15s;
}
/* Menu Dropdown Child */
.navigation-child {
position: absolute;
width: 170px;
left: 170px;
top: 74px;
display: none;
}
.navigation-column-child {
color: #fff;
text-decoration: none;
font-size: 15px;
font-weight: bold;
font-family: "Quicksand";
display: block;
padding: 17px 0 17px 0;
text-align: center;
border-bottom: 1px solid #085b39;
}
.navigation-column-link {
color: #fff;
text-decoration: none;
font-size: 15px;
font-weight: bold;
font-family: "Quicksand";
display: block;
padding: 17px 0 17px 0;
text-align: center;
border-bottom: 1px solid #085b39;
}
li:hover > a {
background: #045030;
}
.navigation-column {
margin-top: 20px;
}
.navigation > li:hover > div {
opacity: 1;
visibility: visible;
overflow: visible;
}
<!DOCTYPE html>
<html lang="ro">
<head>
<title>Meniu CSS Dropdown</title>
<link rel="stylesheet" href="css/style.css" />
<link href="https://fonts.googleapis.com/css?family=Bungee&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Quicksand&display=swap" rel="stylesheet">
</head>
<body>
<h1 class="font-produse-h">Produse</h1>
<ul class="navigation">
<li>
Gaming
<div>
<div class="navigation-column">
<ul>
<li><a class="navigation-column-link" href="#">Console Gaming</a></li>
<li><a class="navigation-column-child" href="#">Accesorii Gaming</a>
<ul class="navigation-child">
<li><a class="navigation-column-link" href="#">Ochelari VR Gaming</a></li>
<li><a class="navigation-column-link" href="#">Gamepad / Controler</a></li>
<li><a class="navigation-column-link" href="#">Volane</a></li>
<li><a class="navigation-column-link" href="#">Casti Console</a></li>
<li><a class="navigation-column-link" href="#">Streaming</a></li>
</ul>
</li>
<li><a class="navigation-column-link" href="#">Scaune Gaming</a></li>
<li><a class="navigation-column-link" href="#">Licente Electronice</a></li>
<li><a class="navigation-column-link" href="#">Jocuri Console & PC</a></li>
<li><a class="navigation-column-link" href="#">PC Gaming</a></li>
<li><a class="navigation-column-link" href="#">Accesorii PC</a></li>
<li><a class="navigation-column-link" href="#">Resigilate</a></li>
</ul>
</div>
</div>
</li>
<li>Gaming 2</li>
<li>Gaming 3</li>
<li>Gaming 4</li>
<li>Gaming 5</li>
</ul>
</body>
</html>
You are on the right path. You can go deeper in the css selector to make a hover statement on each navigation item and change whatever code you want from there to display the child ul. Simple example below:
.navigation li ul li:hover ul {
display: block;
}
I want to reduce the size of the drop down menus to the same as the buttons. Adjusting either the padding or margin would move the items out of place and close themselves when I try to hover over it. I'd like to know what is causing this. Here's the Fiddle
Any help would be great.
CSS:
.sort ul {
text-align: left;
display: inline;
margin: 0;
list-style: none;
-webkit-box-shadow: 0 0 1px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0 0 1px rgba(0, 0, 0, 0.15);
float:right;
}
.sort ul li {
font: bold 12px/18px sans-serif;
display: inline-block;
margin-right: -4px;
position: relative;
padding: 15px 20px;
background: #FF5C00 url(http://i1350.photobucket.com/albums/p769/Stonecold_Stone/Games/SoManySales/Joint%20Supplement/alert-overlay_zpsf561d19b.png) repeat-x;
cursor: pointer;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
color:#fff;
}
.sort ul li:hover {
background: #555;
color: #fff;
}
.sort ul li ul {
padding: 0;
position: absolute;
top: 48px;
left: 0;
width: 150px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
display: none;
opacity: 0;
visibility: hidden;
-webkit-transiton: opacity 0.2s;
-moz-transition: opacity 0.2s;
-ms-transition: opacity 0.2s;
-o-transition: opacity 0.2s;
-transition: opacity 0.2s;
}
.sort ul li ul li {
background: #FFDFDF;
display: block;
color: #fff;
text-shadow: 0 -1px 0 #000;
z-index:9999;
}
.sort ul li ul li:hover { background: #666; }
.sort ul li:hover ul {
display: block;
opacity: 1;
visibility: visible;
}
.button, ul{ padding-left: 15px;}
.button {
list-style: none; cursor: pointer;
float: left; margin: 10px 10px;
background-color: #039fd3; color: #fff;
padding: 5px 10px;
font-size: 13px;
border-radius: 3px;
-webkit-transition:background-color 0.3s ease-in;
-moz-transition:background-color 0.3s ease-in;
-o-transition:background-color 0.3s ease-in;
transition:background-color 0.3s ease-in;
}
HTML:
<div class="sort"><ul>
<li>
Sort AXXX
<ul>
<li><a href='#'>SXXXX</a></li>
<li><a href='%#%'>AXXXx</a></li>
</ul>
</li>
<li>Sort BXXX
<ul>
<li><a href='%#%'>CXXXX</a></li>
</ul>
</li>
<li>Sort C
<ul>
<li><a href='%#%'>WSXXXX</a></li>
<li><a href='%#%'>SXXXX</a></li>
</ul>
</li>
</ul></div>
Following the op coding style, in order to adjust the width of the dropdown it is required to set a width value for the list items under .sort div. Also added paddings similar to the ones set to the blue buttons on the left.
.sort ul li{
width:70px;
padding-top:5px;
padding-bottom:5px;
padding-left:5px;
padding-right:5px;
}
Also it is necesary to adjust the top relative position of the sub menu to always be below the the main menu,
.sort ul li ul{
top:100%;
}
To adjust the distance from the top of the menu to be the same as with the buttons, it is possible to tweak the top relative distance of the menu to achieve it.
The ul element containing the buttons is a block element and the list items within it are floated with a margin-top of 10px and padding-top of 5px so a total of 15px from the top. The ul element within div.sort is floated to the right and has a padding-top of 5px so with margin-top 10px (i.e. 15-5) should be aligned with the buttons.
.sort > ul{
margin-top:10px;
}
http://jsfiddle.net/fLSyE/
First is, if you want your buttons and drop down menu to have the same size, just set the width to be the same. Here is an example(from your code):
.sort ul li ul {
padding: 0;
position: absolute;
top: 48px;
left: 0;
width: 100px; /* set width of drop down menu to 100px */
-webkit-box-shadow: none;
/* SOME OTHER CODES FOLLOW */
}
.sort ul li {
font: bold 12px/18px sans-serif;
display: inline-block;
margin-right: -4px;
width: 100px; /* also set the width of the menus to 100px */
position: relative;
padding: 15px 20px;
}
Hope it helps!
My site has one drop down menu which does not work in iOS or on android. I know the problem is due to the lack of cursor on these devices, so I'm looking to switch the menu from a hover action to a clickable one. I lack the proper terms to speak intelligently on this subject so hopefully what I'm asking makes sense. www.salvageinteriors.com
Here's my code:
CSS:
#cssmenu ul {
margin: 0;
padding: 0;
}
#cssmenu li {
margin: 0;
padding: 0;
z-index: 29;
}
#cssmenu a {
margin: 0;
padding: 0;
}
#cssmenu ul {
list-style: none;
}
#cssmenu a {
text-decoration: none;
}
#cssmenu {
height: 31px;
background-color: #ffffff;
box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.4);
width: 940px;
}
#cssmenu > ul > li {
float: left;
margin-left: 45px;
margin-top: -20px;
position: relative;
}
#cssmenu > ul > li > a {
color: #000000;
font-family: calibri;
font-size: 18px;
line-height: 70px;
padding: 15px 20px;
-webkit-transition: color .15s;
-moz-transition: color .15s;
-o-transition: color .15s;
transition: color .15s;
}
#cssmenu > ul > li > a:hover {
color: #000000;
}
#cssmenu > ul > li > ul {
opacity: 0;
visibility: hidden;
padding: 16px 0 20px 0;
background-color: #000000;
text-align: left;
position: absolute;
top: 55px;
left: 50%;
margin-left: -90px;
width: 180px;
-webkit-transition: all .3s .1s;
-moz-transition: all .3s .1s;
-o-transition: all .3s .1s;
transition: all .3s .1s;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.4);
-moz-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.4);
box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.4);
}
#cssmenu > ul > li:hover > ul {
opacity: 1;
top: 65px;
visibility: visible;
}
#cssmenu > ul > li > ul:before {
content: '';
display: block;
border-color: transparent transparent #000000 transparent;
border-style: solid;
border-width: 10px;
position: absolute;
top: -20px;
left: 50%;
margin-left: -10px;
}
#cssmenu > ul ul > li {
position: relative;
}
#cssmenu ul ul a {
color: #ffffff;
font-family: Verdana, 'Lucida Grande';
font-size: 13px;
background-color: #000000;
padding: 5px 8px 7px 16px;
display: block;
-webkit-transition: background-color 0.1s;
-moz-transition: background-color 0.1s;
-o-transition: background-color 0.1s;
transition: background-color 0.1s;
}
#cssmenu ul ul a:hover {
background-color: #000000;
}
#cssmenu ul ul ul {
visibility: hidden;
opacity: 0;
position: absolute;
top: -16px;
left: 206px;
padding: 16px 0 20px 0;
background-color: #ffffff;
text-align: left;
width: 180px;
-webkit-transition: all .3s;
-moz-transition: all .3s;
-o-transition: all .3s;
transition: all .3s;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.4);
-moz-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.4);
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.4);
}
#cssmenu ul ul > li:hover > ul {
opacity: 1;
left: 190px;
visibility: visible;
}
#cssmenu ul ul a:hover {
background-color: #ffffff;
color: #000000;
}
HTML:
<div id='cssmenu'>
<ul>
<li class='has-sub'><a href='http://www.salvageinteriors.com/p/work.html'> <span>Work</span></a>
<ul>
<li><a href='http://www.salvageinteriors.com/p/commercial.html'><span>Commercial Fixtures</span></a></li>
<li><a href='http://www.salvageinteriors.com/p/furniture_13.html'><span>Furniture</span></a></li>
<li class='last'><a href='http://www.salvageinteriors.com/p/accoutrements.html'><span>Accoutrements</span></a></li>
</ul>
</li>
<li><a href='http://www.salvageinteriors.com/p/about.html'><span>About</span></a></li>
<li><a href='http://www.salvageinteriors.com/p/clients.html'><span>Clients</span></a></li>
<li><a href='http://www.salvageinteriors.com/p/press.html'><span>Press</span></a></li>
<li><a href='http://salvageinteriors.bigcartel.com/' target='_blank'><span>Shop</span></a></li>
<li><a href='http://salvageinteriorsblog.com/' target='_blank'><span>Blog</span></a></li>
<li class='last'><a href='http://www.salvageinteriors.com/p/contact.html'> <span>Contact</span></a></li>
</ul>
</div>
honestly, at least until everyone can figure out hovers for touch devices, we're kind of screwed when it comes to this stuff. There are two ways to work around this:
1) put all of your hover declarations behind a touch class and use Modernizr to add a touch class to your body element whenever the device is detected to be touch enabled.
2)Or you can just put your hover declarations inside of a media query that targets anything over 1024px.
Neither of these are very good solutions, but I will be the first to admit that I have used them before. I would probably use Modernizr if possible.
I'm working on getting my site up and running, and I've run into a problem with my drop-down navigation menu in Firefox.
I have been using the site in Chrome and it works fine, it is a simple setup of nested lists for the selections. The options appear, but they are floating to the left instead of directly below their appropriate section.
CSS:
/*sub-menu navigation*/
nav.primary ul ul
{
opacity: 0;
filter: alpha(opacity=0);
position: absolute;
z-index: 999;
background: #111111;
height: 0px;
overflow: hidden;
min-width: 100%;
-webkit-transition: opacity 0.4s ease-out;
-moz-transition: opacity 0.4s ease-out;
-o-transition: opacity 0.4s ease-out;
-ms-transition: opacity 0.4s ease-out;
transition: opacity 0.4s ease-out;
-webkit-box-shadow: 0px 2px 2px rgba(0,0,0,0.3);
-moz-box-shadow: 0px 2px 2px rgba(0,0,0,0.3);
box-shadow: 0px 2px 2px rgba(0,0,0,0.3);
}
nav.primary ul li:hover ul
{
opacity: 10;
filter: alpha(opacity=100);
height: auto;
overflow: auto;
}
nav.primary ul ul li
{
float: none;
display: list-item;
border-bottom: 1px solid #747474;
}
nav.primary ul ul li a
{
display: block;
margin-left: 10px;
line-height: 40px;
font-size: 0.8em;
/*text-transform: none;*/
font-family: 'LibbyRegular', Helvetica, Arial, sans-serif;
}
Menu HTML
<ul>
<li>independent work
<ul>
<li>>> big and ugly</li>
<li>>> iceworld</li>
<li>>> gordon's got game</li>
</ul>
</li>
<li>team projects
<ul>
<li>>> blastrobots</li>
<li>>> ruined</li>
</ul>
</li>
<li>scripting
<ul>
<li>>> hero man (C#)</li>
<li>>> CloneOut (lua)</li>
<li>>> shotgun (unrealscript)</li>
</ul>
</li>
<li>resume</li>
</ul>
The site is http://lvsherman.com if you would like to test it.
Try adding to your inner UL elements.
left: 0;
top: WHATEVER;
I am trying to extend my header to cover the full page. http://dev.webgrowth.biz/ and I want it look like this one http://www.webgrowth.biz/ I have been trying everything for hours now. any help would be highly appreciated.
Live Demo
You can achieve the effect using a container element, then just set the containing elements margin to 0 auto and it will be centered.
Markup
<div id="header">
<div id="headerContent">
Header text
</div>
</div>
CSS
#header{
width:100%;
background: url(yourimage);
}
#headerContent{
margin: 0 auto; width: 960px;
}
Just set the header width to be 100vw to make it full screen width
and set the header height to be 100vh to make it full screen height
#header {
margin: 0;
padding: 0;
width: 100%;
background: xxxx;
}
#header #content {
margin: 0px auto;
width: 800px; /* or whatever */
}
<div id="header">
<div id="content">
stuff here
</div>
</div>
Set the max-width:1250px; that is currently on your body on your #container. This way your header will be 100% of his parent (body) :)
The best way to make the header full screen is set height to be 100vh
#header{
height: 100vh;
}
min-height: 100%;
position: relative;
set the body max-width:110%;
and the make the width on the header 110% it will leave a small margin on left that you can fiX with margin-left: -8px;
margin-top: -10px;
Remove the max-width from the body, and put it to the #container.
So, instead of:
body {
max-width:1250px;
}
You should have:
#container {
max-width:1250px;
}
just do
#RandomDiv{
width: 100%;
}
html:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css"
</head>
<body>
<ul class="menu">
<li>My Dashboard
<ul>
<li>Learn</li>
<li>Teach</li>
<li>My Library</li>
</ul>
</li>
<li>Likes
<ul>
<li>Pictures</li>
<li>Audio</li>
<li>Videos</li>
</ul>
</li>
<li>Views
<ul>
<li>Documents</li>
<li>Messages</li>
<li>Videos</li>
</ul>
</li>
<li>account
<ul>
<li>Sign In</li>
<li>Register</li>
<li>Deactivate</li>
</ul>
</li>
<li>Uploads
<ul>
<li>Pictures</li>
<li>Audio</li>
<li>Videos</li>
</ul>
</li>
<li>Videos
<ul>
<li>Add</li>
<li>Delete</li>
</ul>
</li>
<li>Documents
<ul>
<li>Upload</li>
<li>Download</li>
</ul>
</li>
</ul>
</body>
</html>
css:
.menu,
.menu ul,
.menu li,
.menu a {
margin: 0;
padding: 0;
border: none;
outline: none;
}
body{
max-width:110%;
margin-left:0;
}
.menu {
height: 40px;
width:110%;
margin-left:-4px;
margin-top:-10px;
background: #4c4e5a;
background: -webkit-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: -moz-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: -o-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: -ms-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
background: linear-gradient(top, #4c4e5a 0%,#2c2d33 100%);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.menu li {
position: relative;
list-style: none;
float: left;
display: block;
height: 40px;
}
.menu li a {
display: block;
padding: 0 14px;
margin: 6px 0;
line-height: 28px;
text-decoration: none;
border-left: 1px solid #393942;
border-right: 1px solid #4f5058;
font-family: Helvetica, Arial, sans-serif;
font-weight: bold;
font-size: 13px;
color: #f3f3f3;
text-shadow: 1px 1px 1px rgba(0,0,0,.6);
-webkit-transition: color .2s ease-in-out;
-moz-transition: color .2s ease-in-out;
-o-transition: color .2s ease-in-out;
-ms-transition: color .2s ease-in-out;
transition: color .2s ease-in-out;
}
.menu li:first-child a { border-left: none; }
.menu li:last-child a{ border-right: none; }
.menu li:hover > a { color: #8fde62; }
.menu ul {
position: absolute;
top: 40px;
left: 0;
opacity: 0;
background: #1f2024;
-webkit-border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
-webkit-transition: opacity .25s ease .1s;
-moz-transition: opacity .25s ease .1s;
-o-transition: opacity .25s ease .1s;
-ms-transition: opacity .25s ease .1s;
transition: opacity .25s ease .1s;
}
.menu li:hover > ul { opacity: 1; }
.menu ul li {
height: 0;
overflow: hidden;
padding: 0;
-webkit-transition: height .25s ease .1s;
-moz-transition: height .25s ease .1s;
-o-transition: height .25s ease .1s;
-ms-transition: height .25s ease .1s;
transition: height .25s ease .1s;
}
.menu li:hover > ul li {
height: 36px;
overflow: visible;
padding: 0;
}
.menu ul li a {
width: 100px;
padding: 4px 0 4px 40px;
margin: 0;
border: none;
border-bottom: 1px solid #353539;
}
.menu ul li:last-child a { border: none; }
demo here
try also resizing the browser tab to see it in action