need to change dropdown menu to full length - css

I need to get the dropdown to run full length of the menu, would there be an easy way to do this without completely restructuring this menu?
Thanks.
example - JSfiddle
#menu {
list-style:none;
width:940px;
margin:30px auto 0px auto;
height:43px;
padding:0px 20px 0px 20px;
}
#menu li {
float:left;
display:block;
text-align:center;
position:relative;
padding: 4px 10px 4px 10px;
margin-right:30px;
margin-top:7px;
border:none;
}

I'm not sure if it's "easy" method, but I've modified JSFiddle for that purpose - no html mods needed.
HTML:
<ul id="menu">
<li>Home<!-- Begin Home Item -->
<div class="dropdown_2columns"><!-- Begin 2 columns container -->
<div class="col_2">
<h2>Welcome !</h2>
</div>
<div class="col_2">
<p>Hi and welcome here ! This is a showcase of the possibilities of this awesome Mega Drop Down Menu.</p>
<p>This item comes with a large range of prepared typographic stylings such as headings, lists, etc.</p>
</div>
<div class="col_2">
<h2>Cross Browser Support</h2>
</div>
<div class="col_1">
<img src="img/browsers.png" width="125" height="48" alt="" />
</div>
<div class="col_1">
<p>This mega menu has been tested in all major browsers.</p>
</div>
</div><!-- End 2 columns container -->
</li><!-- End Home Item -->
<li>Features<!-- Begin 5 columns Item -->
<div class="dropdown_5columns"><!-- Begin 5 columns container -->
<div class="col_5">
<h2>This is an example of a large container with 5 columns</h2>
</div>
<div class="col_1">
<p class="black_box">This is a dark grey box text. Fusce in metus at enim porta lacinia vitae a arcu. Sed sed lacus nulla mollis porta quis.</p>
</div>
<div class="col_1">
<p>Phasellus vitae sapien ac leo mollis porta quis sit amet nisi. Mauris hendrerit, metus cursus accumsan tincidunt.</p>
</div>
<div class="col_1">
<p class="italic">This is a sample of an italic text. Consequat scelerisque. Fusce sed lectus at arcu mollis accumsan at nec nisi porta quis sit amet.</p>
</div>
<div class="col_1">
<p>Curabitur euismod gravida ante nec commodo. Nunc dolor nulla, semper in ultricies vitae, vulputate porttitor neque.</p>
</div>
<div class="col_1">
<p class="strong">This is a sample of a bold text. Aliquam sodales nisi nec felis hendrerit ac eleifend lectus feugiat scelerisque.</p>
</div>
<div class="col_5">
<h2>Here is some content with side images</h2>
</div>
<div class="col_3">
<img src="img/01.jpg" width="70" height="70" class="img_left imgshadow" alt="" />
<p>Maecenas eget eros lorem, nec pellentesque lacus. Aenean dui orci, rhoncus sit amet tristique eu, tristique sed odio. Praesent ut interdum elit. Sed in sem mauris. Aenean a commodo mi. Praesent augue lacus.Read more...</p>
<img src="img/02.jpg" width="70" height="70" class="img_left imgshadow" alt="" />
<p>Aliquam elementum felis quis felis consequat scelerisque. Fusce sed lectus at arcu mollis accumsan at nec nisi. Aliquam pretium mollis fringilla. Nunc in leo urna, eget varius metus. Aliquam sodales nisi.Read more...</p>
</div>
<div class="col_2">
<p class="black_box">This is a black box, you can use it to highligh some content. Sed sed lacus nulla, et lacinia risus. Phasellus vitae sapien ac leo mollis porta quis sit amet nisi. Mauris hendrerit, metus cursus accumsan tincidunt.Quisque vestibulum nisi non nunc blandit placerat. Mauris facilisis, risus ut lobortis posuere, diam lacus congue lorem, ut condimentum ligula est vel orci. Donec interdum lacus at velit varius gravida. Nulla ipsum risus.</p>
</div>
</div><!-- End 5 columns container -->
</li><!-- End 5 columns Item -->
<li>Solutions<!-- Begin 4 columns Item -->
<div class="dropdown_4columns"><!-- Begin 4 columns container -->
<div class="col_4">
<h2>This is a heading title</h2>
</div>
<div class="col_1">
<h3>Some Links</h3>
<ul>
<li>ThemeForest</li>
<li>GraphicRiver</li>
<li>ActiveDen</li>
<li>VideoHive</li>
<li>3DOcean</li>
</ul>
</div>
<div class="col_1">
<h3>Useful Links</h3>
<ul>
<li>NetTuts</li>
<li>VectorTuts</li>
<li>PsdTuts</li>
<li>PhotoTuts</li>
<li>ActiveTuts</li>
</ul>
</div>
<div class="col_1">
<h3>Other Stuff</h3>
<ul>
<li>FreelanceSwitch</li>
<li>Creattica</li>
<li>WorkAwesome</li>
<li>Mac Apps</li>
<li>Web Apps</li>
</ul>
</div>
<div class="col_1">
<h3>Misc</h3>
<ul>
<li>Design</li>
<li>Logo</li>
<li>Flash</li>
<li>Illustration</li>
<li>More...</li>
</ul>
</div>
</div><!-- End 4 columns container -->
</li><!-- End 4 columns Item -->
<li class="menu_right">Blog
<div class="dropdown_1column align_right">
<div class="col_1">
<ul class="simple">
<li>FreelanceSwitch</li>
<li>Creattica</li>
<li>WorkAwesome</li>
<li>Mac Apps</li>
<li>Web Apps</li>
<li>NetTuts</li>
<li>VectorTuts</li>
<li>PsdTuts</li>
<li>PhotoTuts</li>
<li>ActiveTuts</li>
<li>Design</li>
<li>Logo</li>
<li>Flash</li>
<li>Illustration</li>
<li>More...</li>
</ul>
</div>
</div>
</li>
<li class="menu_right">About<!-- Begin 3 columns Item -->
<div class="dropdown_3columns align_right"><!-- Begin 3 columns container -->
<div class="col_3">
<h2>Lists in Boxes</h2>
</div>
<div class="col_1">
<ul class="greybox">
<li>FreelanceSwitch</li>
<li>Creattica</li>
<li>WorkAwesome</li>
<li>Mac Apps</li>
<li>Web Apps</li>
</ul>
</div>
<div class="col_1">
<ul class="greybox">
<li>ThemeForest</li>
<li>GraphicRiver</li>
<li>ActiveDen</li>
<li>VideoHive</li>
<li>3DOcean</li>
</ul>
</div>
<div class="col_1">
<ul class="greybox">
<li>Design</li>
<li>Logo</li>
<li>Flash</li>
<li>Illustration</li>
<li>More...</li>
</ul>
</div>
<div class="col_3">
<h2>Here are some image examples</h2>
</div>
<div class="col_3">
<img src="img/02.jpg" width="70" height="70" class="img_left imgshadow" alt="" />
<p>Maecenas eget eros lorem, nec pellentesque lacus. Aenean dui orci, rhoncus sit amet tristique eu, tristique sed odio. Praesent ut interdum elit. Maecenas imperdiet, nibh vitae rutrum vulputate, lorem sem condimentum.Read more...</p>
<img src="img/01.jpg" width="70" height="70" class="img_left imgshadow" alt="" />
<p>Aliquam elementum felis quis felis consequat scelerisque. Fusce sed lectus at arcu mollis accumsan at nec nisi. Aliquam pretium mollis fringilla. Vestibulum tempor facilisis malesuada. Read more...</p>
</div>
</div><!-- End 3 columns container -->
</li><!-- End 3 columns Item -->
</ul>
CSS:
/* Navigation Bar */
#menu {
list-style:none;
width:940px;
margin:30px auto 0px auto;
height:43px;
padding:0px 20px 0px 20px;
}
#menu li {
float:left;
display:block;
text-align:center;
padding: 4px 10px 4px 10px;
margin-right:30px;
margin-top:7px;
border:none;
}
#menu li:hover {
border: 2px solid #EEEEEE;
padding: 4px 9px 4px 9px;
/* Background color and gradients */
background: #F4F4F4;
background: -moz-linear-gradient(top, #F4F4F4, #EEEEEE);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#F4F4F4), to(#EEEEEE));
}
#menu li a {
font-family:Arial, Helvetica, sans-serif;
font-size:16px;
color: #f76b04;
display:block;
outline:0;
text-decoration:none;
}
/* Drop Down */
.dropdown_1column,
.dropdown_2columns,
.dropdown_3columns,
.dropdown_4columns,
.dropdown_5columns {
margin:4px auto;
float:left;
position:absolute;
left:-999em; /* Hides the drop down */
text-align:left;
padding:10px 5px 10px 5px;
border:1px solid #EEEEEE;
border-top:none;
/* Gradient background */
background:#F4F4F4;
background: -moz-linear-gradient(top, #EEEEEE, #BBBBBB);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#EEEEEE), to(#BBBBBB));
/* Rounded Corners */
-moz-border-radius: 0px 5px 5px 5px;
-webkit-border-radius: 0px 5px 5px 5px;
border-radius: 0px 5px 5px 5px;
}
.dropdown_1column {width: 140px;}
.dropdown_2columns {width: 280px;}
.dropdown_3columns {width: 420px;}
.dropdown_4columns {width: 560px;}
.dropdown_5columns {width: 700px;}
#menu li:hover .dropdown_1column,
#menu li:hover .dropdown_2columns,
#menu li:hover .dropdown_3columns,
#menu li:hover .dropdown_4columns,
#menu li:hover .dropdown_5columns {
left:0;
top:auto;
width:100%;
}
/* Columns */
.col_1,
.col_2,
.col_3,
.col_4,
.col_5 {
display:inline;
float: left;
position: relative;
margin-left: 5px;
margin-right: 5px;
}
.col_1 {width:130px;}
.col_2 {width:270px;}
.col_3 {width:410px;}
.col_4 {width:550px;}
.col_5 {width:690px;}
/* Right alignment */
#menu .menu_right {
float:right;
margin-right:0px;
}
#menu li .align_right {
/* Rounded Corners */
-moz-border-radius: 5px 0px 5px 5px;
-webkit-border-radius: 5px 0px 5px 5px;
border-radius: 5px 0px 5px 5px;
}
#menu li:hover .align_right {
left:auto;
right:-1px;
top:auto;
}
/* Drop Down Content Stylings */
#menu p, #menu h2, #menu h3, #menu ul li {
font-family:Arial, Helvetica, sans-serif;
line-height:21px;
font-size:12px;
text-align:left;
text-shadow: 1px 1px 1px #FFFFFF;
}
#menu h2 {
font-size:21px;
font-weight:400;
letter-spacing:-1px;
margin:7px 0 14px 0;
padding-bottom:14px;
border-bottom:1px solid #666666;
}
#menu h3 {
font-size:14px;
margin:7px 0 14px 0;
padding-bottom:7px;
border-bottom:1px solid #888888;
}
#menu p {
line-height:18px;
margin:0 0 10px 0;
}
#menu li:hover div a {
font-size:12px;
color:#261b13;
}
#menu li:hover div a:hover {
color:#f76b04;
}
.strong {
font-weight:bold;
}
.italic {
font-style:italic;
}
.imgshadow {
background:#FFFFFF;
padding:4px;
border:1px solid #777777;
margin-top:5px;
-moz-box-shadow:0px 0px 5px #666666;
-webkit-box-shadow:0px 0px 5px #666666;
box-shadow:0px 0px 5px #666666;
}
.img_left { /* Image sticks to the left */
width:auto;
float:left;
margin:5px 15px 5px 5px;
}
#menu li .black_box {
background-color:#333333;
color: #eeeeee;
text-shadow: 1px 1px 1px #000;
padding:4px 6px 4px 6px;
/* Rounded Corners */
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
/* Shadow */
-webkit-box-shadow:inset 0 0 3px #000000;
-moz-box-shadow:inset 0 0 3px #000000;
box-shadow:inset 0 0 3px #000000;
}
#menu li ul {
list-style:none;
padding:0;
margin:0 0 12px 0;
}
#menu li ul li {
font-size:12px;
line-height:24px;
position:relative;
text-shadow: 1px 1px 1px #5e5b59;
padding:0;
margin:0;
float:none;
text-align:left;
width:130px;
}
#menu li ul li:hover {
background:none;
border:none;
padding:0;
margin:0;
}
#menu li .greybox li {
background:#F4F4F4;
border:1px solid #bbbbbb;
margin:0px 0px 4px 0px;
padding:4px 6px 4px 6px;
width:116px;
text-shadow: 1px 1px 1px #eeeeee;
/* Rounded Corners */
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
#menu li .greybox li:hover {
background:#ffffff;
border:1px solid #aaaaaa;
padding:4px 6px 4px 6px;
margin:0px 0px 4px 0px;
}
You'll need to adjust your submenu's content to accomodate changes.

Related

Extra White Space on Right Page CSS/HTML

Good Day Im new to CSS
And recently after I have finish my first project, an extra white space came up on my page, Then I have found out that the hr tag that I am using is one reason why there an extra white space(I guess?) , when I put hr size
#hr{
width:960px;
margin: 0px auto;
color:#C0C0C0;
height: 12px;
margin-bottom:15px;
overflow:hidden;
}
white page will appear
But when I put
#hr {
width:70%;
margin: 0px auto;
color:#C0C0C0;
height: 12px;
margin-bottom:15px;
overflow:hidden;
}
This will be ok but zooming it in/out will move the hr line,
If needed I'll post the codes but my codes is so many...
Right, I think ill put my codes,
HTML CODES:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Beginner</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link href="css/style.css" rel="stylesheet" type="text/css" media="screen" />
<style type="text/css">
</style>
</head>
<body>
<div id="top-most">
</div>
<div id="wrapper">
<div id="logo">
<img alt="logo" src="images/logo.png" />
</div>
<div id="header">
<p>info#CreativeStudio.com</p>
</div>
<div id="top-bar-selection" >
<ul>
<li>HOME</li>
<li> ABOUT US </li>
<li> PORTFOLIO </li>
<li> SERVICES </li>
<li> BLOG </li>
<li> CONTACT US </li>
</ul>
</div>
</div>
<hr id="hr" />
<div id="banner">
<object id="flash1" data="Beginner.swf" type="application/x-shockwave-flash" style="width: 960px; height: 380px">
<param name="movie" value="Beginner.swf" />
</object>
</div>
<div id="hr2">
<hr />
</div>
<div id="information">
<div id="about-us-section">
<div id="about-us">
<h3>→ ABOUT US</h3>
</div>
<div id="hr">
<hr />
</div>
<div id="content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque quis nulla id orci malesuada porta posuere quis massa. Nunc vitae purus non augue scelerisque ulitricies vitae et velit. Sed vitae lectus id sem lobortis scelerisque. Praesent eget consequat libero.</p>
<p style="height: 3px"></p>→<h4>Read</h4>
</div>
</div>
<div id="our-benefits-section">
<div id="our-benefits">
<h3>→ OUR BENEFITS</h3>
</div>
<div id="hr">
<hr />
</div>
<div id="content">
<p>☑Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque quis nulla id orci malesuada porta posuere quis massa. </p>
<p>☑ Nunc vitae purus non augue scelerisque ulitricies vitae et velit. Sed vitae lectus id sem lobortis scelerisque. Praesent eget consequat</p>
<p>☑Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque quis nulla id orci malesuada porta posuere quis massa. </p>
</div>
</div>
<div id="testimonials-section">
<div id="testimonials">
<h3>→ TESTIMONIALS</h3>
</div>
<div id="hr">
<hr />
</div>
<div id="content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque quis nulla id orci malesuada porta posuere quis massa. Nunc vitae purus non augue scelerisque ulitricies vitae et velit. Sed vitae lectus id sem lobortis scelerisque. Praesent eget consequat libero.</p>
<h5>Rafi, Graphicsfuel.com</h5></div>
</div>
</div>
<div id="hr">
<hr />
</div>
<div id="our-portfolio-section">
<div id="our-portfolio">
<h3>→ OUR PORTFOLIO</h3>
</div>
<img alt="PortfolioA" src="images/Portfolio A.jpg" id ="picA" />
<img alt="PortfolioB" src="images/Portfolio B.jpg" id ="picB"/>
<img alt="PortfolioC" src="images/Portfolio C.jpg" id ="picC"/>
<img alt="PortfolioD" src="images/Portfolio D.jpg" id ="picD"/>
</div>
<div id="hr">
<hr />
</div>
<div id="information2">
<div id="blog-updates-section">
<div id="blog-updates">
<h4>→ BLOG UPDATES</h4>
</div>
<div class="content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque quis nulla id orci malesuada porta posuere quis massa. Nunc vitae purus non augue scelerisque ulitricies vitae et velit. Sed vitae lectus id sem lobortis scelerisque. Praesent eget consequat libero.</p>
</div>
</div>
<div id="socialmedia">
<h6> → CONNECT WITH US</h6>
<img alt="" src="images/Icon/Twitter.png" />
<img alt="" src="images/Icon/Facebook.png" />
<img alt="" src="images/Icon/Flickr.png" />
<img alt="" src="images/Icon/RSS.png" />
</div>
</div>
<div id="footerbgcolor">
<div id="footer">
<div class="below-bar-selection">
<p>Home | About Us | Portfolio | Services | Blog | Contact Us</p>
<p>© 2010 CreativeStudio. All Rights Reserved</p>
</div>
<div class="logo-small" style="left: 770px; top: 1240px; width: 128px">
<img alt="" src="images/Icon/Logo%20Small.png" />
</div>
</div>
</div>
</body>
</html>
CSS CODES:
#top-most { background-color:black; height:17px; }
#wrapper { width :960px; height:130px ; margin:0px auto; background-color: #F4F4F4; overflow:hidden; }
#logo { margin: 19px 0 0 10px; float:left; }
#header { float: right; margin: 19px 3px 0 0; }
#header p { color: #979899; }
#top-bar-selection { width:960px;position :absolute ; overflow:hidden; display:inline-block; margin:70px auto 0 -160px; word-spacing:1px; letter-spacing:1px;}
#top-bar-selection ul{color:orange; text-align: right; }
#top-bar-selection ul li {display :inline; font-size:12px; font-family: arial black; margin: 0 32px 0 0;}
#top-bar-selection ul li a:link {color: #fe9a00; font-family: Arial black; }
#top-bar-selection ul li a:hover {color: #000000; font-family: Arial black; }
#hr { width: auto; margin: 0px auto; color:#C0C0C0; height: 12px; margin-bottom:15px; overflow:hidden;}
#hr2 { width:960px; margin: 0px auto ; margin-top:10px; height:9px;}
#banner { width:960px; height:380px ; margin:0px auto; background-color: black; }
#information { width:960px; margin :0px auto 0 auto; height:235px; padding-top : 15px; margin-top:13px; }
#about-us-section { width: 266px; margin-right: 600px; background-color: #F4F4F4; position:absolute; padding-right: 10px; }
#about-us-section hr { background-color:black; height:7px; width:260px; margin:10px 0 0 0; position:absolute; }
#about-us-section p { padding-top: 10px; font-weight:lighter;}
#about-us-section h4 { color:#FF9933; display:inline; line-height:30px;}
#about-us-section h4 a:link {color: #fe9a00; font-family: Arial black; }
#about-us-section h4 a:active {color: #fe9a00; font-family: Arial black;}
#about-us-section h4 a:visited {color: #fe9a00; font-family: Arial black;}
#about-us-section h4 a:hover { color:#000000; }
#our-benefits-section { width: 270px; margin: 0 0 0 355px; background-color : #F4F4F4; position:absolute; padding-right: 10px;}
#our-benefits-section hr { background-color:black; height:7px; width:260px; margin:10px 0 0 0; position:absolute; }
#our-benefits-section p { padding-top: 10px; }
#testimonials-section { width: 270px; margin: 0 0 0 700px; position:absolute; padding-right: 10px; }
#testimonials-section hr { background-color:black; height:7px; width:260px; margin:10px 0 0 0; position:absolute; }
#testimonials-section p { padding-top: 10px; font-weight:300; }
#testimonials-section h5 { padding-top: 10px; font-style:italic; }
#our-portfolio-section { width:960px; margin: 0px auto 0 auto; display: block; height:205px; }
#our-portfolio-section our-portfolio { margin: 5px 2px 0 0; }
#our-portfolio-section img { padding: 15px; display:inline;}
#information2 { width:960px; margin :0px auto 0 auto; height:145px; margin-top:5px; }
#blog-updates-section { width:600px; height:50px; position:absolute; }
#blog-updates-section h3 {margin: 8px 5px 0 0; line-height:10px;}
#blog-updates-section p {margin: 28px 5px 0 0; }
#blog-updates .content { margin: 28px 5px 0 0; float:left; position:absolute;}
#socialmedia { float:right; overflow:hidden; position:absolute;margin: 10px 720px; width: 150px; height: 125px; width:200px;}
#socialmedia h6 { font-size:10px;}
#socialmedia img { padding: 6px; margin-top:20px; }
#footerbgcolor { background-color:#E2E2E2; height:100px; }
#footer { width :960px; height:100px ; overflow:hidden; margin:0px auto; }
#footer .below-bar-selection { margin: 30px 0 0 20px; float:left; width: 750px; }
#footer a:link {color: #000000; font-family: Arial black; }
#footer a:active {color: #000000; font-family: Arial black;}
#footer a:visited {color: #000000; font-family: Arial black;}
#footer h4 a:hover { color:#000000; font-family:Arial black;}
#footer .logo-small { float:right; padding-top: 15px;}
If you already got a better solution, then forget this message,
But i noticed something.
according to your code
#hr {
width: auto;
margin: 0px auto;
color:#C0C0C0;
height: 12px;
margin-bottom:15px;
overflow:hidden;}
Since your id of Wrapper is 960 pixels,
use that width template to set your HR' width value.
so change:
width: auto;
to
width: 958px;
Notice: 960px looks a bit too long, so i shaved some pixels out to fit the alignment. But if 960 looks better, then choose 960.
Well first of all i don't see any white space on right side of the page rather space between the hr tag due to the height you have given.
Secondly,
hr tag will automatically create a line. If you want to give it an id that means you want to add additional styling to the hr element.
If i am understanding properly, than you shouldn't even use WIDTH.
#hr{
// no need to use width as it will automatcally fill it self
margin: 0px auto;
color:#C0C0C0;
height: 12px; // only needed if you want to create space inbetween
margin-bottom:15px;
overflow:hidden;
}
and use it as
<hr id="hr" />
Hope this answers your question.
Since you only posted the CSS code without the HTML code, it may be hard for people to see the whole problem, but from the information you posted, this will be my proposed solution,
This css code:
width:960px;
makes your HR a fixed width of 960 pixels.
This css code:
width:70%;
makes your HR take up 70% of its container's width.
You could just try setting the width to 100%.
p.s. Why do you need it to be 70% ?
hr { //remove # so it will apply to <hr> tag
width:70%;
margin: 10px auto; // change the margin size so the hr line can be seen
color:#C0C0C0;
margin-bottom:15px;
overflow:hidden;
}
I think the problem that could remove the hr line is only about margin. If the margin is set to 0, then the hr line could be override by another tag

Vertical Align with Absolute Positioning

In the following code I'm trying to make the elements within the green div.middle elements to vertically align to the middle.
I've tried the table-cell approach but cant get it working. I heard it's due to absolute positioning and tried this solution with no luck:
CSS - Vertical align table-cell don't work with position absolute
This appears to be due to .table-cell having no height - I would like it's height to equal its parent container, which varies in height.
jsfiddle:
http://jsfiddle.net/q5jKM/1/
Does anyone know a way of getting the green div.middle elements to vertically align to the middle? Any method will do. It just needs to be capable of handling its variable height. Is it possible with just css? Or will I have to jump in with a bit of jQuery?
Edit:
box-align also isn't a viable solution due to browser support and being replaced with new standard.
CSS
html,body{height:100%;margin:0}
#sidebar {
width: 22em;
position:fixed;
top: 0;
bottom: 0;
left: 0;
z-index:2;
color: #ffffff;
background-color: #333333;
overflow:auto;
height: 100%;
}
#sidebar .nav {
width: 3em;
float: right;
background-color: #2e2e2e;
border-left: 2px groove #454545;
height: 100%;
position:relative;
min-height:34em;
}
#sidebar .content {
height: 100%;
width: 16.875em; /* 17-(2/16) - 20em - .nav - nav border*/
float:left;
position:relative;
min-height:34em;
}
#sidebar .top {
position:absolute;
top:0;
}
#sidebar .bottom {
position:absolute;
bottom:0;
}
#sidebar .middle {
position: absolute;
bottom: 12em; /* 3.125*3 */
top: 16em; /* 3.125*4 */
background: green;
}
.content .middle {
overflow:auto;
}
#sidebar .content > div {width: 16.875em; } /*.top .middle .bottom*/
#sidebar .nav > div {width:3em; } /*.top .middle .bottom*/
/*table-cell trying get vertical-align working*/
#sidebar .table-cell {display:table-cell; vertical-align: middle; }
#sidebar .content p, #sidebar .content li, #sidebar .content img {font-size: .75em; color: #dddddd;}
#sidebar ul {margin:0; padding: 0;}
#sidebar .nav li {
padding: .5625em;
list-style:none;
}
#sidebar .nav li img {
height: 1.875em;
width: 1.875em
}
#sidebar .nav .top li { border-bottom: 2px groove #454545 }
#sidebar .nav .bottom li { border-top: 2px groove #454545 }
.content li {
position:relative;
display:block;
background-color: #444;
padding: .72em;
border-radius: .8em;
border-bottom: 1px solid #292929;
border-top: 1px solid #4c4c4c;
text-align: center;
font-size: 1em;
letter-spacing: .1em;
font-weight: normal;
height: 1.2em;
}
.content li:after {
content:"";
position:absolute;
display:block;
width:0;
top:.11em; /* controls vertical position */
right:-.852em; /* value = - border-left-width - border-right-width */
border-style:solid;
border-width:1.2em 0 1.2em 1.2em;
border-color:transparent #444;
}
.content .top li{margin: .95em 0 1.9em 0;}
.content .bottom li{margin: 1.9em 0 .95em 0;}
.content .logo {
text-align: center;
padding: 1em 0 2em 0;
width: 100%;
border-bottom: 2px groove #454545;
}
.content p.welcome {
text-align: center;
line-height: 1.5em;
margin: 1em 0;
}
HTML
<div id="sidebar">
<div class="nav">
<div class="top">
<ul>
<li><img src="_images/attributes/attribute2.svg"></li>
<li><img src="_images/attributes/attribute2.svg"></li>
<li><img src="_images/attributes/attribute2.svg"></li>
<li><img src="_images/attributes/attribute2.svg"></li>
</ul>
</div>
<div class="middle"><div class="table-cell"><p>test</p></div></div>
<div class="bottom">
<ul>
<li><img src="_images/attributes/attribute2.svg"></li>
<li><img src="_images/attributes/attribute2.svg"></li>
<li><img src="_images/attributes/attribute2.svg"></li>
</ul>
</div>
</div>
<div class="content">
<div class="top">
<ul>
<li>SIDEBAR LINK</li>
<li>SIDEBAR LINK</li>
<li>SIDEBAR LINK</li>
<li>SIDEBAR LINK</li>
</ul>
</div>
<div class="middle"><div class="table-cell">
<div class="logo"><img src="_images/g.svg"></div>
<p class="welcome">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris dictum tellus viverra neque bibendum in mattis ante dignissim. Nam mattis feugiat lorem porttitor adipiscing. Aliquam erat volutpat. Nunc feugiat magna vitae mauris egestas euismod. In hac habitasse platea dictumst. Praesent magna sem, malesuada non fermentum vel, luctus quis mauris. Duis quam purus, ornare vitae eleifend sed, malesuada eget libero. Phasellus sed lorem risus, nec placerat urna. In magna turpis, accumsan ac egestas quis, dictum vel massa. Nulla vitae magna arcu. Maecenas sit amet vestibulum urna. Integer feugiat dignissim leo sed ornare. Maecenas auctor ultricies dui, pulvinar tincidunt velit feugiat quis. Sed egestas ornare elit, et fringilla quam viverra ut.</p>
</div></div>
<div class="bottom">
<ul>
<li>SIDEBAR LINK</li>
<li>SIDEBAR LINK</li>
<li>SIDEBAR LINK</li>
</ul>
</div>
</div>
</div>
add a parent div with display:table and height:100% to .table-cell will fix this
So the html structure wil be :
<div class="middle">
<div class="table">
<div class="table-cell">
<p>test</p>
</div>
</div>
</div>
add this Style:
#sidebar .table{
display:table;
height:100%;
}
See jsfiddle I have modified
You can set a height for that table-cell.
.table-cell{
height: 200px;/* for example */
vertical-align: middle;
display: table-cell;}
<div class="middle"><div class="table-cell"><p>test</p></div></div>
I used to have problems with vertical-align property before. I tend to realize that this property seemed to be more suited for tables. So I added this in your code on JSFiddle and it looked alright to me. Could you see if this would work with you?
<div class="middle">
<table height="100%" width="100%">
<tr>
<td style="vertical-align:middle">
<p>test</p>
</td>
</tr>
</table>
</div>

Fixed Element Overflow

I'm trying to get the #sidebar element to scroll overflow once the browser window is shorter than it's minimum height but can't seem to get it working. Any idea why?
http://jsfiddle.net/q5jKM/1/
CSS - Sorry I cant get this funky formatting working.
html,body{height:100%;margin:0}
#sidebar {
width: 20em;
position:fixed;
top: 0;
bottom: 0;
left: 0;
z-index:2;
color: #ffffff;
background-color: #333333;
overflow:auto;
min-height: 34em;
}
#sidebar .nav {
width: 3em;
float: right;
overflow: auto;
background-color: #2e2e2e;
border-left: 2px groove #454545;
height: 100%;
position:relative;
}
#sidebar .content {
height: 100%;
width: 16.875em; /* 17-(2/16) - 20em - .nav - nav border*/
float:left;
position:relative;
}
#sidebar .top {
position:absolute;
top:0;
}
#sidebar .bottom {
position:absolute;
bottom:0;
}
#sidebar .middle {
position: absolute;
bottom: 12em; /* 3.125*3 */
top: 16em; /* 3.125*4 */
background: green;
}
.content .middle {
overflow:auto;
}
#sidebar .content > div {width: 16.875em; } /*.top .middle .bottom*/
#sidebar .nav > div {width:3em; } /*.top .middle .bottom*/
/*table-cell trying get vertical-align working*/
#sidebar .table-cell {display:table-cell;}
#sidebar .middle .table-cell {vertical-align: middle;}
#sidebar .content p, #sidebar .content li, #sidebar .content img {font-size: .75em; color: #dddddd;}
#sidebar ul {margin:0; padding: 0;}
#sidebar .nav li {
padding: .5625em;
list-style:none;
}
#sidebar .nav li img {
height: 1.875em;
width: 1.875em
}
#sidebar .nav .top li { border-bottom: 2px groove #454545 }
#sidebar .nav .bottom li { border-top: 2px groove #454545 }
.content li {
position:relative;
display:block;
background-color: #444;
padding: .72em;
border-radius: .8em;
border-bottom: 1px solid #292929;
border-top: 1px solid #4c4c4c;
text-align: center;
font-size: 1em;
letter-spacing: .1em;
font-weight: normal;
height: 1.2em;
}
.content li:after {
content:"";
position:absolute;
display:block;
width:0;
top:.11em; /* controls vertical position */
right:-.852em; /* value = - border-left-width - border-right-width */
border-style:solid;
border-width:1.2em 0 1.2em 1.2em;
border-color:transparent #444;
}
.content .top li{margin: .95em 0 1.9em 0;}
.content .bottom li{margin: 1.9em 0 .95em 0;}
.content .logo {
text-align: center;
padding: 1em 0 2em 0;
width: 100%;
border-bottom: 2px groove #454545;
}
.content p.welcome {
text-align: center;
line-height: 1.5em;
margin: 1em 0;
}
HTML
<div id="sidebar">
<div class="nav">
<div class="top">
<ul>
<li><img src="_images/attributes/attribute2.svg"></li>
<li><img src="_images/attributes/attribute2.svg"></li>
<li><img src="_images/attributes/attribute2.svg"></li>
<li><img src="_images/attributes/attribute2.svg"></li>
</ul>
</div>
<div class="middle"><div class="table-cell"><p>test</p></div></div>
<div class="bottom">
<ul>
<li><img src="_images/attributes/attribute2.svg"></li>
<li><img src="_images/attributes/attribute2.svg"></li>
<li><img src="_images/attributes/attribute2.svg"></li>
</ul>
</div>
</div>
<div class="content">
<div class="top">
<ul>
<li>SIDEBAR LINK</li>
<li>SIDEBAR LINK</li>
<li>SIDEBAR LINK</li>
<li>SIDEBAR LINK</li>
</ul>
</div>
<div class="middle"><div class="table-cell">
<div class="logo"><img src="_images/g.svg"></div>
<p class="welcome">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris dictum tellus viverra neque bibendum in mattis ante dignissim. Nam mattis feugiat lorem porttitor adipiscing. Aliquam erat volutpat. Nunc feugiat magna vitae mauris egestas euismod. In hac habitasse platea dictumst. Praesent magna sem, malesuada non fermentum vel, luctus quis mauris. Duis quam purus, ornare vitae eleifend sed, malesuada eget libero. Phasellus sed lorem risus, nec placerat urna. In magna turpis, accumsan ac egestas quis, dictum vel massa. Nulla vitae magna arcu. Maecenas sit amet vestibulum urna. Integer feugiat dignissim leo sed ornare. Maecenas auctor ultricies dui, pulvinar tincidunt velit feugiat quis. Sed egestas ornare elit, et fringilla quam viverra ut.</p>
</div></div>
<div class="bottom">
<ul>
<li>SIDEBAR LINK</li>
<li>SIDEBAR LINK</li>
<li>SIDEBAR LINK</li>
</ul>
</div>
</div>
</div>
Got it!
Add: - So that #sidebar's is equal to the browser window.
#sidebar{height:100%}
And add: - To provide content that overflows.
#sidebar .nav, #sidebar .content {min-height:34em}
Once the browser window becomes shorter than 34ems #sidebar will overflow.
You just need to add a CSS media query rule:
#media all and (min-height: 34em) {
#sidebar{
overflow: scroll;
}
}
Once the browser height is less than 34em, then the overflow: scroll rule will be added to the #sidebar.
Use overflow scroll instead of auto
See this http://jsfiddle.net/q5jKM/2/
I got this to work using jquery - you need to get the height of the browser and adjust the css overflow to scroll when it reaches a certain height
var heightToScroll = 600;
var viewHeight = $(window).height();
$(window).resize(function() {
if(viewHeight < heightToScroll){
$('#sidebar').css("overflow","scroll");
}
});
http://jsfiddle.net/q5jKM/3/

Viewing site in IE causes Quirks mode, making it unusable

I tried looking for hours for a fix to this, and nothing has worked. I am trying to just build a menu bar, but it is not working correctly in IE (I test in IE7 and 8.) Everything opens IE in quirks mode. I have looked reasons as to the cause of this and tried everything I could where it is now beyond my understanding. I ran both the CSS and HTML files through the validation, and both came back with zero problems. I heard about hidden BOM characters aand white space before the doctype and ran both files through a detector, with both coming back fine. I apologize, but I am not as advanced as some on here, and thank ahead of time for any help. Any education as to what might be causing this would be appreciated. I cannot post the URL because this is an intranet site, so I will just post the code I'm using.
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="menu.css" type="text/css" media="screen" />
<title>Mega Drop Down Menu</title>
<!--[if IE 6]>
<style>
body {behavior: url("csshover3.htc");}
#menu li .drop {background:url("img/drop.gif") no-repeat right 8px;
</style>
<![endif]-->
</head>
<body>
<ul id="menu">
<li>Home
<div class="dropdown_2columns">
<div class="col_2">
<h2>Welcome !</h2>
</div>
<div class="col_2">
<p>Hi and welcome here ! This is a showcase of the possibilities of this awesome Mega Drop Down Menu.</p>
<p>This item comes with a large range of prepared typographic stylings such as headings, lists, etc.</p>
</div>
<div class="col_2">
<h2>Cross Browser Support</h2>
</div>
<div class="col_1">
<img src="img/browsers.png" width="125" height="48" alt="" />
</div>
<div class="col_1">
<p>This mega menu has been tested in all major browsers.</p>
</div>
</div>
</li>
<li>5 Columns
<div class="dropdown_5columns">
<div class="col_5">
<h2>This is an example of a large container with 5 columns</h2>
</div>
<div class="col_1">
<p class="black_box">This is a dark grey box text. Fusce in metus at enim porta lacinia vitae a arcu. Sed sed lacus nulla mollis porta quis.</p>
</div>
<div class="col_1">
<p>Phasellus vitae sapien ac leo mollis porta quis sit amet nisi. Mauris hendrerit, metus cursus accumsan tincidunt.</p>
</div>
<div class="col_1">
<p class="italic">This is a sample of an italic text. Consequat scelerisque. Fusce sed lectus at arcu mollis accumsan at nec nisi porta quis sit amet.</p>
</div>
<div class="col_1">
<p>Curabitur euismod gravida ante nec commodo. Nunc dolor nulla, semper in ultricies vitae, vulputate porttitor neque.</p>
</div>
<div class="col_1">
<p class="strong">This is a sample of a bold text. Aliquam sodales nisi nec felis hendrerit ac eleifend lectus feugiat scelerisque.</p>
</div>
<div class="col_5">
<h2>Here is some content with side images</h2>
</div>
<div class="col_3">
<img src="img/01.jpg" width="70" height="70" class="img_left imgshadow" alt="" />
<p>Maecenas eget eros lorem, nec pellentesque lacus. Aenean dui orci, rhoncus sit amet tristique eu, tristique sed odio. Praesent ut interdum elit. Sed in sem mauris. Aenean a commodo mi. Praesent augue lacus.Read more...</p>
<img src="img/02.jpg" width="70" height="70" class="img_left imgshadow" alt="" />
<p>Aliquam elementum felis quis felis consequat scelerisque. Fusce sed lectus at arcu mollis accumsan at nec nisi. Aliquam pretium mollis fringilla. Nunc in leo urna, eget varius metus. Aliquam sodales nisi.Read more...</p>
</div>
<div class="col_2">
<p class="black_box">This is a black box, you can use it to highligh some content. Sed sed lacus nulla, et lacinia risus. Phasellus vitae sapien ac leo mollis porta quis sit amet nisi. Mauris hendrerit, metus cursus accumsan tincidunt.Quisque vestibulum nisi non nunc blandit placerat. Mauris facilisis, risus ut lobortis posuere, diam lacus congue lorem, ut condimentum ligula est vel orci. Donec interdum lacus at velit varius gravida. Nulla ipsum risus.</p>
</div>
</div>
</li>
<li>4 Columns
<div class="dropdown_4columns">
<div class="col_4">
<h2>This is a heading title</h2>
</div>
<div class="col_1">
<h3>Some Links</h3>
<ul>
<li>ThemeForest</li>
<li>GraphicRiver</li>
<li>ActiveDen</li>
<li>VideoHive</li>
<li>3DOcean</li>
</ul>
</div>
<div class="col_1">
<h3>Useful Links</h3>
<ul>
<li>NetTuts</li>
<li>VectorTuts</li>
<li>PsdTuts</li>
<li>PhotoTuts</li>
<li>ActiveTuts</li>
</ul>
</div>
<div class="col_1">
<h3>Other Stuff</h3>
<ul>
<li>FreelanceSwitch</li>
<li>Creattica</li>
<li>WorkAwesome</li>
<li>Mac Apps</li>
<li>Web Apps</li>
</ul>
</div>
<div class="col_1">
<h3>Misc</h3>
<ul>
<li>Design</li>
<li>Logo</li>
<li>Flash</li>
<li>Illustration</li>
<li>More...</li>
</ul>
</div>
</div>
</li>
<li class="menu_right">1 Column
<div class="dropdown_1column align_right">
<div class="col_1">
<ul class="simple">
<li>FreelanceSwitch</li>
<li>Creattica</li>
<li>WorkAwesome</li>
<li>Mac Apps</li>
<li>Web Apps</li>
<li>NetTuts</li>
<li>VectorTuts</li>
<li>PsdTuts</li>
<li>PhotoTuts</li>
<li>ActiveTuts</li>
<li>Design</li>
<li>Logo</li>
<li>Flash</li>
<li>Illustration</li>
<li>More...</li>
</ul>
</div>
</div>
</li>
<li class="menu_right">3 columns
<div class="dropdown_3columns align_right">
<div class="col_3">
<h2>Lists in Boxes</h2>
</div>
<div class="col_1">
<ul class="greybox">
<li>FreelanceSwitch</li>
<li>Creattica</li>
<li>WorkAwesome</li>
<li>Mac Apps</li>
<li>Web Apps</li>
</ul>
</div>
<div class="col_1">
<ul class="greybox">
<li>ThemeForest</li>
<li>GraphicRiver</li>
<li>ActiveDen</li>
<li>VideoHive</li>
<li>3DOcean</li>
</ul>
</div>
<div class="col_1">
<ul class="greybox">
<li>Design</li>
<li>Logo</li>
<li>Flash</li>
<li>Illustration</li>
<li>More...</li>
</ul>
</div>
<div class="col_3">
<h2>Here are some image examples</h2>
</div>
<div class="col_3">
<img src="img/02.jpg" width="70" height="70" class="img_left imgshadow" alt="" />
<p>Maecenas eget eros lorem, nec pellentesque lacus. Aenean dui orci, rhoncus sit amet tristique eu, tristique sed odio. Praesent ut interdum elit. Maecenas imperdiet, nibh vitae rutrum vulputate, lorem sem condimentum.Read more...</p>
<img src="img/01.jpg" width="70" height="70" class="img_left imgshadow" alt="" />
<p>Aliquam elementum felis quis felis consequat scelerisque. Fusce sed lectus at arcu mollis accumsan at nec nisi. Aliquam pretium mollis fringilla. Vestibulum tempor facilisis malesuada. Read more...</p>
</div>
</div>
</li>
</ul>
</body>
</html>
The CSS here
body, ul, li {
font-size:14px;
font-family:Arial, Helvetica, sans-serif;
line-height:21px;
text-align:left;
}
#menu {
list-style:none;
width:940px;
margin:30px auto 0px auto;
height:43px;
padding:0px 20px 0px 20px;
/* Rounded Corners */
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
/* Background color and gradients */
background: #014464;
background: -moz-linear-gradient(top, #0272a7, #013953);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#0272a7), to(#013953));
/* Borders */
border: 1px solid #002232;
-moz-box-shadow:inset 0px 0px 1px #edf9ff;
-webkit-box-shadow:inset 0px 0px 1px #edf9ff;
box-shadow:inset 0px 0px 1px #edf9ff;
}
#menu li {
float:left;
display:block;
text-align:center;
position:relative;
padding: 4px 10px 4px 10px;
margin-right:30px;
margin-top:7px;
border:none;
}
#menu li:hover {
border: 1px solid #777777;
padding: 4px 9px 4px 9px;
/* Background color and gradients */
background: #F4F4F4;
background: -moz-linear-gradient(top, #F4F4F4, #EEEEEE);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#F4F4F4), to(#EEEEEE));
/* Rounded corners */
-moz-border-radius: 5px 5px 0px 0px;
-webkit-border-radius: 5px 5px 0px 0px;
border-radius: 5px 5px 0px 0px;
}
#menu li a {
font-family:Arial, Helvetica, sans-serif;
font-size:14px;
color: #EEEEEE;
display:block;
outline:0;
text-decoration:none;
text-shadow: 1px 1px 1px #000;
}
#menu li:hover a {
color:#161616;
text-shadow: 1px 1px 1px #ffffff;
}
#menu li .drop {
padding-right:21px;
background:url("img/drop.png") no-repeat right 8px;
}
#menu li:hover .drop {
background:url("img/drop.png") no-repeat right 7px;
}
.dropdown_1column,
.dropdown_2columns,
.dropdown_3columns,
.dropdown_4columns,
.dropdown_5columns {
margin:4px auto;
float:left;
position:absolute;
left:-999em; /* Hides the drop down */
text-align:left;
padding:10px 5px 10px 5px;
border:1px solid #777777;
border-top:none;
/* Gradient background */
background:#F4F4F4;
background: -moz-linear-gradient(top, #EEEEEE, #BBBBBB);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#EEEEEE), to(#BBBBBB));
/* Rounded Corners */
-moz-border-radius: 0px 5px 5px 5px;
-webkit-border-radius: 0px 5px 5px 5px;
border-radius: 0px 5px 5px 5px;
}
.dropdown_1column {width: 140px;}
.dropdown_2columns {width: 280px;}
.dropdown_3columns {width: 420px;}
.dropdown_4columns {width: 560px;}
.dropdown_5columns {width: 700px;}
#menu li:hover .dropdown_1column,
#menu li:hover .dropdown_2columns,
#menu li:hover .dropdown_3columns,
#menu li:hover .dropdown_4columns,
#menu li:hover .dropdown_5columns {
left:-1px;
top:auto;
}
.col_1,
.col_2,
.col_3,
.col_4,
.col_5 {
display:inline;
float: left;
position: relative;
margin-left: 5px;
margin-right: 5px;
}
.col_1 {width:130px;}
.col_2 {width:270px;}
.col_3 {width:410px;}
.col_4 {width:550px;}
.col_5 {width:690px;}
#menu .menu_right {
float:right;
margin-right:0px;
}
#menu li .align_right {
/* Rounded Corners */
-moz-border-radius: 5px 0px 5px 5px;
-webkit-border-radius: 5px 0px 5px 5px;
border-radius: 5px 0px 5px 5px;
}
#menu li:hover .align_right {
left:auto;
right:-1px;
top:auto;
}
#menu p, #menu h2, #menu h3, #menu ul li {
font-family:Arial, Helvetica, sans-serif;
line-height:21px;
font-size:12px;
text-align:left;
text-shadow: 1px 1px 1px #FFFFFF;
}
#menu h2 {
font-size:21px;
font-weight:400;
letter-spacing:-1px;
margin:7px 0 14px 0;
padding-bottom:14px;
border-bottom:1px solid #666666;
}
#menu h3 {
font-size:14px;
margin:7px 0 14px 0;
padding-bottom:7px;
border-bottom:1px solid #888888;
}
#menu p {
line-height:18px;
margin:0 0 10px 0;
}
#menu li:hover div a {
font-size:12px;
color:#015b86;
}
#menu li:hover div a:hover {
color:#029feb;
}
.strong {
font-weight:bold;
}
.italic {
font-style:italic;
}
.imgshadow { /* Better style on light background */
background:#FFFFFF;
padding:4px;
border:1px solid #777777;
margin-top:5px;
-moz-box-shadow:0px 0px 5px #666666;
-webkit-box-shadow:0px 0px 5px #666666;
box-shadow:0px 0px 5px #666666;
}
.img_left { /* Image sticks to the left */
width:auto;
float:left;
margin:5px 15px 5px 5px;
}
#menu li .black_box {
background-color:#333333;
color: #eeeeee;
text-shadow: 1px 1px 1px #000;
padding:4px 6px 4px 6px;
/* Rounded Corners */
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
/* Shadow */
-webkit-box-shadow:inset 0 0 3px #000000;
-moz-box-shadow:inset 0 0 3px #000000;
box-shadow:inset 0 0 3px #000000;
}
#menu li ul {
list-style:none;
padding:0;
margin:0 0 12px 0;
}
#menu li ul li {
font-size:12px;
line-height:24px;
position:relative;
text-shadow: 1px 1px 1px #ffffff;
padding:0;
margin:0;
float:none;
text-align:left;
width:130px;
}
#menu li ul li:hover {
background:none;
border:none;
padding:0;
margin:0;
}
#menu li .greybox li {
background:#F4F4F4;
border:1px solid #bbbbbb;
margin:0px 0px 4px 0px;
padding:4px 6px 4px 6px;
width:116px;
/* Rounded Corners */
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-khtml-border-radius: 5px;
border-radius: 5px;
}
#menu li .greybox li:hover {
background:#ffffff;
border:1px solid #aaaaaa;
padding:4px 6px 4px 6px;
margin:0px 0px 4px 0px;
}
This happened to me as well with one of the websites I manage, everything passed validation from the W3C, the Web Developer plugin for Firefox reported no issues and yet we were seeing IE go into quirks mode...that is, until we added this meta tag:
<meta http-equiv="X-UA-Compatible" content="IE=edge">

Wrapper 100% height, fixed footer and fixed menu

I know, this topic has been opened 1000 times, but I didn't find a suitable solution (or a solution I could understand).
I have a simple page (wordpress) with a fixed nav menu on the left, scrollable content in center and a fixed footer (always visible).
I have 2 problems I have tried to solve in every way:
1) the wrapper (100% height) wraps ok until you scroll the page, but does not extend after the scroll (see attached image, page is scrolled to bottom).
2) the content at the bottom is under the footer, I couldn't find a way to apply a -30 padding to make readable the final part of the content ( I think this relates to the problem no.1).
Here is the CSS (also used a reset.css based on YUI reset):
/* LAYOUT */
.aligncenter { display:block; margin:0 auto }
.alignleft { float:left }
.alignright { float:right }
.wp-caption { border:1px solid #666; text-align:center; background:#ccc; padding:10px; margin:10px }
br.clear { clear:both; display:block; height:1px; margin:-1px 0 0 0 }
/* GENERAL LAYOUT */
html, body{
margin : 0;
padding : 0;
height : 100%;
border : none;
}
#wrapper{
min-height: 100%;
width: 100%;
background: red;
overflow: hidden;
}
#container{
width: 960px;
margin-left: 40px;
padding-bottom: 30px
}
#navigation{
position: fixed;
overflow:hidden;
width: 200px;
}
#content{
position: absolute;
overflow: auto;
width: 420px;
margin-left: 220px;
}
li > a {
display: block;
}
a {outline: none;}
/* NAVIGATION */
h1.logo {
height: 155px;
}
#navigation ul{
margin:0;
padding:0;
text-align: right;
}
#navigation ul li{
height:28px;
display: inline-block;
color:#000;
padding: 0 0 0 0;
overflow:hidden;
line-height: 28px;
margin-bottom: 7px;
}
#navigation li a{
padding: 0 28px 0 0;
}
.nav-blog{
width:190px;
border-left-color: #d1bbe8;
border-left-width: 10px;
border-left-style: solid;
background-color: #edece6;
}
.nav-eventi{
width:190px;
border-left-color: #aa87a0;
border-left-width: 10px;
border-left-style: solid;
background-color: #edece6;
}
.nav-bio{
width:190px;
border-left-color: #e2b893;
border-left-width: 10px;
border-left-style: solid;
background-color: #edece6;
}
.nav-discography{
width:190px;
border-left-color: #365f68;
border-left-width: 10px;
border-left-style: solid;
background-color: #edece6;
}
.nav-photos{
width:190px;
border-left-color: #545768;
border-left-width: 10px;
border-left-style: solid;
background-color: #edece6;
}
.nav-videos{
width:190px;
border-left-color: #4b5668;
border-left-width: 10px;
border-left-style: solid;
background-color: #edece6;
}
.nav-contact{
width:190px;
border-left-color: #686055;
border-left-width: 10px;
border-left-style: solid;
background-color: #edece6;
}
/* ----------Active links----------- */
.home .nav-blog
{
width: 150px;
}
/* POST */
#ilpost{
width: 420px;
margin: 0 0 18px 0;
}
.spaziovuoto{
height: 155px;
}
.type-blog{
border-top-color: #d1bbe8;
border-top-style: solid;
border-top-width: 12px;
}
#tempo{
height: 32px;
background: url('../images/flatback.png');
}
.iltitolo{
background-color: #edece6;
}
.ilcontenuto{
background-color: #edece6;
}
/* PLAYER */
#player{
clear: both;
width: 100%;
position: fixed;
bottom: 0px;
height: 30px;
background: #000;
color:#fff;
}
And the HTML:
(head omitted)
<body class="home blog">
<div id="wrapper">
<div id="container">
<div id="navigation">
<h1 class="logo">Logo</h1>
<ul>
<li class="nav-blog "><a href="/">blog</li>
<li class="nav-eventi sel">eventi</li>
<li class="nav-bio sel">bio</li>
<li class="nav-discography sel">discography</li>
<li class="nav-photos sel">photos</li>
<li class="nav-videos sel">videos</li>
<li class="nav-contact sel">contact</li>
</ul>
</div><!-- .navigation -->
<script type="text/javascript">
jQuery(function($){
$.supersized({
//Background image
transition_speed : 50,
slides : [ { image : 'http://localhost/xxxxxxxx/wp-content/themes/xxxxxxxxxx/images/sfondotest1080.jpg' } ]
});
});
</script>
<div id="content">
<div class="spaziovuoto"></div>
<!-- LOOOOOOOOOOOP -->
<div id="ilpost" class="type-blog">
<div id="tempo">
Uncategorized // 10 April, 2011</div><!-- .tempo -->
<div class="ilcontenuto">
<p class="iltitolo">test post 4</p>
<p><!-- p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica} -->Morbi euismod magna ac lorem rutrum elementum. Donec viverra auctor lobortis. Pellentesque eu est a nulla placerat dignissim. Morbi a enim in magna semper bibendum. Etiam scelerisque, nunc ac egestas consequat, odio nibh euismod nulla, eget auctor orci nibh vel nisi. Aliquam erat volutpat. Mauris vel neque sit amet nunc gravida congue.</p>
<p> </p>
</div>
</div><!-- .ilpost -->
<div id="ilpost" class="type-blog">
<div id="tempo">
Uncategorized // 10 April, 2011</div><!-- .tempo -->
<div class="ilcontenuto">
<p class="iltitolo">test post 3</p>
<p><!-- p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica} -->Morbi euismod magna ac lorem rutrum elementum. Donec viverra auctor lobortis. Pellentesque eu est a nulla placerat dignissim. Morbi a enim in magna semper bibendum. Etiam scelerisque, nunc ac egestas consequat, odio nibh euismod nulla, eget auctor orci nibh vel nisi. Aliquam erat volutpat. Mauris vel neque sit amet nunc gravida congue.</p>
<p> </p>
</div>
</div><!-- .ilpost -->
<div id="ilpost" class="type-blog">
<div id="tempo">
Uncategorized // 10 April, 2011</div><!-- .tempo -->
<div class="ilcontenuto">
<p class="iltitolo">test post 2</p>
<p><!-- p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica} --> <!-- p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica} -->Morbi euismod magna ac lorem rutrum elementum. Donec viverra auctor lobortis. Pellentesque eu est a nulla placerat dignissim. Morbi a enim in magna semper bibendum. Etiam scelerisque, nunc ac egestas consequat, odio nibh euismod nulla, eget auctor orci nibh vel nisi. Aliquam erat volutpat. Mauris vel neque sit amet nunc gravida congue.</p>
<p> </p>
</div>
</div><!-- .ilpost -->
<div id="ilpost" class="type-blog">
<div id="tempo">
Uncategorized // 10 April, 2011</div><!-- .tempo -->
<div class="ilcontenuto">
<p class="iltitolo">Hello world!</p>
<p>Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!</p>
</div>
</div><!-- .ilpost -->
</div><!-- .content -->
<ul class="xoxo">
</ul>
</div> <!-- container -->
</div> <!-- E wrapper-->
<div id="player">Player</div>
</body>
</html>
Just in case, I attached an image with an explanation.
Thanks for your help!
#navigation{
position: fixed;
overflow:hidden;
width: 200px;
left: 40px; /* add this */
}
#content{
/*position: absolute; remove this*/
overflow: auto;
width: 420px;
margin-left: 220px;
}
your page has no content.. well it thinks it doesn't ;)
so remove the absolute positioning from the content .. let the content remain in the flow this should mean that the existing min-height on the wrapper actually gets a chance to work (at the minute it thinks there's nothing in it so it can't grow)
that then appears to work but IE7 gets a bit pernickety, like it does and moves the nav over the content - so just explicitly (give a tsk and) tell it where you want it to be (help it count!) and add the left position on #navigation
Have you tried using min-height: 100% instead of height: 100% on your body and html styles?
As far as the wrapper, take off the 100% height. It will default to auto height and expand to the content.
For the content under the footer you just apply a bottom padding to the content, and take off the absolute positioning. Just put a left margin on it (and possibly a float).

Resources