Reputation: 621
When I try to link on top of banner is not working. I thing It's something wrong with Div z-index. But I couldn't get it. Can any one please help me to fix this . I have attached related with this. Please use the Following Link to see the site.
http://10.8.12.41/srilanka/
#header{
color: #CFCFCF;
font-weight: 600;
/*border-bottom: 4px solid #84AE03;*/
background:#fff;
width: 100%;
z-index: 10;
}
#banner{
height: 100%;
margin: 0px auto 0;
position: relative;
width: 1000px;
z-index: 1;}
#topnavbar{
height: 26px;
/* margin:-5px 102px 0 0;*/
position: relative;
background:url(../images/top_lin.png) repeat-x;
float:left;
width:100%;
float:right;
}
#topnavmenu{
float:right;
width:300px;
padding:3px;
}
#topnavmenu a{
color: #FFFFFF;
display: inline-block;
font-family: 'Open Sans Condensed',sans-serif;
font-size: 11px;
font-weight: 600;
/*line-height: 35px;*/
padding: 0;
text-align: center;
text-decoration: none;
width: auto;
z-index:10px;
}
#apDiv2 {
height: 100%;
margin:0px auto;
position: relative;
width: 1000px;
z-index: 1;
background:url(../images/menubg.png) repeat;
background-color:#00247d;
}
Html
------------------------------------------------
<div id="topnavbar">
<div id="topnavmenu">
<a href="#">CheckmyTrip</a> |<a href="#">Baggage</a> | <a href="#">Travel Tips</a>
</div>
</div>
<div id="banner">
<img src="images/Banner.png" />
</div>
<div id="apDiv2">
<!-- Start css3menu.com BODY section id=2 -->
<ul id="css3menu2" class="topmenu">
<li class="toplast"><a href="contactus.php" style="height:32px;line-height:32px;"><img src="index_files/css3menu2/contact.png" alt=""/>Contact Us</a></li>
</ul>
<p style="display:none"><a href="http://css3menu.com/">Pure CSS Dropdown Menus Css3Menu.com</a></p>
<!-- End css3menu.com BODY section -->
<p style="display:none"><a href="http://css3menu.com/">Pure CSS Dropdown Menus Css3Menu.com</a></p>
<!-- End css3menu.com BODY section -->
</div>
Upvotes: 1
Views: 1063
Reputation: 1762
z-index
on #banner
was most of your problem.
#header {
color: #CFCFCF;
font-weight: 600;
/*border-bottom: 4px solid #84AE03;*/
background:#fff;
width: 100%;
}
#banner {
height: 100%;
margin: 0px auto 0;
position: relative;
width: 1000px;
z-index: -1;
}
#topnavbar {
height: 26px;
/* margin:-5px 102px 0 0;*/
position: relative;
background:url(http://placehold.it/26x26) repeat-x;
width:100%;
float:right;
}
#topnavmenu {
float:right;
width:300px;
padding:3px;
}
#topnavmenu a {
color: #FFFFFF;
display: inline-block;
font-family:'Open Sans Condensed', sans-serif;
font-size: 11px;
font-weight: 600;
/*line-height: 35px;*/
padding: 0;
text-align: center;
text-decoration: none;
width: auto;
z-index:10px;
}
#apDiv2 {
height: 100%;
margin:0px auto;
position: relative;
width: 1000px;
z-index: 1;
background:url(http://placehold.it/300x300) repeat;
background-color:#00247d;
}
On a different note, I see that you are learning because this code has many things wrong with it. You are doing well but here are a few pointers. First, float: left
and float:right
in the same class does not make sense. Then you are also floating elements that don't need it in a few places. position
is an advanced property that affects z-index
in that z-index
will not work without position
and it can and usually should be used with at least one of these: top
left
right
bottom
. I would only use it if you think you need it. I think your layout as is can all be done without position
.
A lot of people on the site here do not like W3Schools but they are great for a beginner like you.
Keep up the good work and you will get better.
Upvotes: 1