Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

css: Display:inline-table - IE problem

Status
Not open for further replies.

Olavxxx

Programmer
Sep 21, 2004
1,134
NO
Hi,

I made this Horizontal menu, based on CSS.
Below the menu elements, there should appear an arrow, pointing at the elements, on HOVER.

I dont want it to be based on Javascript, as for me, javascript is the devil!

Here is my code:
Code:
.yo a { 
display:block;
width: 100px; 
height: 50px;

padding-left:2px;
padding-right:2px;
	
background: transparent url(images/arr.gif) no-repeat;
background-position: 50% +200px;
text-align:center;

} 

div{
   display: inline-table; 
}

.yo a:hover { 
background-position: 50% +20px;

}

Code:
<div id="menu_">
    <div class="yo"><a href="">Lorem</a></div>
	<div class="yo"><a href="">Ipsum</a></div>
	<div class="yo"><a href="">Dolor</a></div>
	<div class="yo"><a href="">Sitmer</a></div> 
	<div class="yo"><a href="">Utstatico</a></div>
	<div class="yo"><a href="">Ialalancol</a></div>
	</div>

how it works (in Opera atleast):
The image is on default, specified outside of the "box", that contains the hyperlink.

When Hovering the hyperlink, the image (background) is then moved back into the hyperlink "box".

It works perfect in Opera, but in IE, there is a problem with the inline-table display property of CSS.

eg. in IE, it displays not horizontal!

Does anyone know of a workaround for IE?
 
Ah, I already figured it out now, by an accident!

The workaround:
float: left;

Code:
.yo a { 
display:block;
width: 100px; 
height: 50px;

padding-left:2px;
padding-right:2px;
	
background: transparent url(images/arr.gif) no-repeat;
background-position: 50% +200px;
text-align:center;
float:left;
}

I hope this will help people in the future, as it was not very easy to find on google, amongst alot of other crappy examples.

Olav Alexander Mjelde
Admin & Webmaster
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top