I have this HTML code:
<div id="logo">
<div id="left-block">
<h1>Title goes here</h1>
</div>
</div>
<div id="right-block">
<ul>
<li>Menu1</li>
<li>Menu2</li>
<li>Menu3</li>
<li>Menu4</li>
</ul>
</div>
It shows a title at the top-left corner and a item menu at the top right using this CSS code:
#logo {
position: absolute;
z-index: 1;
}
#left-block {
background-color: red;
height: 50px;
}
#right-block {
float: right;
background-color: blue;
height: 50px;
z-index: 5;
}
ul {
float: right;
list-style: none;
}
li {
display: inline;
margin: 0 5px 0 0px;
}
The problem is when I have a long title as showed in this Fiddle example. The title overlaps the menu and z-index seems that is not working (I've put z-index everywhere without success). Why z-index is not working? Is because #logo is absolutely positioned? How to resolve this problem?
NOTE: I can't change this (#logo {position:absolute}
) because other elements not showed in this simplified demo needs it.