Space in CSS between brackets and characters.
16 Apr, 2011
I usually think that in CSS, when there are brackets, I can ignore the spaces beside them. Do you agree?
For the following code:
<div style="background:url(images/zoomabg.png)repeat scroll 0 0 transparent;width:100px;height:100px;"></div>
The background image can be seen in chrome 10 and firefox 3.6
However, it cannot be seen in IE9 using IE8 mode!
It takes a long time to identify the problem, because the div has the correct width, correct height, correct x, correct y, correct display attribute and correct z-index. The problem is found to be about background only after border is added -_-|||
So, after lots of testing, I finally found that, the problem can be solved by simply adding a space between ")" and "repeat".
<div style="background:url(images/zoomabg.png) repeat scroll 0 0 transparent;width:100px;height:100px;"></div>
This will work.