Forum Moderators: open
<div class="dotted_line"><img src="images/spacer.gif" alt="" /></div>
i used html tidy to fix and it converted them lined and tabbed
<div class="dotted_line">
<img src="images/spacer.gif" alt="" />
</div>
and now IE puts a line break on the page inside the div while i want it to be 1px
i have noticed that kind of behaviour on IE on many cases, like theres something wrong with the parsing
any ideas how can it be fixed?
Technically, this isn't even a bug, html usually inserts an extra space, which is what you're seeing, not a line break. That's why something like this in HTML:
hello
world
does not render as helloworld but rather hello world, the browser inserted a space at the line break.
You can work around this default behavior by setting all the css for the div to 0, font-size:0, line-height:0, and a few others, can't remember all of them, but it's easier to either remove the linebreak or not use 1px gifs in the first place, that's what css is for.
That's the only css I can think of though, sorry, I haven't used 1 px spacer/layout gifs for almost 5 years, there's no reason to do that anymore.
You can try setting the div height to 1px if you haven't done that already.
There's ways to work around it, but it's not worth the time, you're trying to work around 3 separate issues here, one is using Tidy, which always makes those types of decisions for you, another is getting around how IE handles that, and the last is using a 1px spacer in the first place.
You can set the spacer as a background property in css, and make it repeat horizontally, that will make the div empty as far as IE is concerned. background:url(spacer.gif) repeat-x or whatever.
Re firefox, you'll rarely have any problems with firefox and css, of all the browsers, that one renders what I tell it to render more consistently than any other one. Then it's off to debug the others.
Any decent text editor will show each character in certain view modes, spaces, tabs, etc. That can be useful in debugging.