I cannot change the height of my div with CSS. It does not seem to be taking affect. Code below. I’m coding in C# ASP.NET with Javascipt and CSS. The below code is included in other files using SSI. The height of .navdiv will not alter no matter the value for height:50px.
ASPX
<link rel="Stylesheet" href="CSS/SSI/header.css" />
<div id="header">
<div id="logo">
<img id="imglogo" src="Images/logo.gif" />
</div>
<div id="nav">
<a class="navlink" href="default.aspx">
<div class="navdiv" id="navhome">
Home
</div>
</a>
<a class="navlink" href="import.aspx">
<div class="navdiv" id="navimport">
Import
</div>
</a>
</div>
</div>
CSS
/*
* header.css
* Created By: Steven T. Norris Created On: 5/12/2012
* Update By: Update On:
*
* Stylesheet for header SSI
*/
/*Main header style*/
#header
{
background-color:#2875ff;
border-color:Black;
border-style:solid;
border-width:2px;
padding:0px;
margin:0px;
}
#logo
{
margin-bottom:10px;
}
#navhome
{
height:100px;
}
/*Navigation styles*/
.navdiv
{
height:50px;
background-color:#000999;
display:inline;
margin-left:10px;
padding-right:5px;
padding-left:5px;
font-size:large;
text-align:center;
color:#c24900;
font-weight:bold;
text-decoration:none;
}
.navdiv:hover
{
color:White;
}
#nav
{
padding:0px;
margin:0px;
height:auto;
width:100%;
}
Using
display: inline-block;will fix the height issue, but if you want the divs to still be side by side, be sure to addfloat: left;to both elements.