Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inline block doesn't work in internet explorer 7, 6

I have this CSS code with an inline-block. Can anyone tell me how to make it work in Internet Explorer 6 and 7. Any ideas? Maybe I'm doing something wrong? Thank you!

#signup {    color:#FFF;    border-bottom:solid 1px #444;    text-transform:uppercase;    text-align:center; } #signup #left {    display: inline-block } #signup #right {    background-image:url(images/signup.jpg);    border-left: solid 1px #000;    border-right: solid 1px #000;    display: inline-block;     padding:1% 2%    width:16%; } #signup #right a { font-size:100%; font-weight:bold }  #signup #right p { font-size:90%; font-weight:bold } #signup a:hover  { color:#FFF; text-decoration:underline } 
like image 550
webmasters Avatar asked Apr 29 '11 23:04

webmasters


People also ask

Why my display inline not working?

An inline element will not accept height and width. It will just ignore it. So the height and width that you have entered in css will be ignored that is why the empty div is not visible. moreover try using inline-block, it will solve the issue.

Can I make a block element inline?

You can set a block-level element to display like an inline element by setting the display property to inline. You can also cause inline elements to behave like block-level elements using the display property.


1 Answers

In IE6/IE7, display: inline-block only works on elements that are naturally inline (such as spans).

To make it work on other elements such as divs, you need this:

#yourElement {     display: inline-block;     *display: inline;     zoom: 1; } 

*display: inline uses a "safe" CSS hack to apply to only IE7 and lower.

For IE6/7, zoom: 1 provides hasLayout. Having "layout" is a prerequisite for display: inline-block to always work.

It is possible to apply this workaround while keeping valid CSS, but it's not really worth thinking about, particularly if you're already using any vendor prefixed properties.

Read this for more information about display: inline-block (but forget about -moz-inline-stack, that was only required for the now ancient Firefox 2).

like image 153
thirtydot Avatar answered Sep 26 '22 10:09

thirtydot