开发者

How to force firefox to ignore white spaces inside <a> tags

开发者 https://www.devze.com 2023-03-09 22:00 出处:网络
code: <a href=\"...\"><img src=\"..\' /><span>..</span></a> works fine in all cases, but

code:

<a href="..."><img src="..' /><span>..</span></a>

works fine in all cases, but

<a href="...">
  <img src="..." />
  <span>..</span>
</a>

doesn't work in firefox, even in the latest FF. Seems it's default behavior in IE & chrome to ignore(collpase) the extra white spaces and line feeds. But it's not the case in FF.

Is there any way to 开发者_如何学Pythonforce firefox to ignore the white spaces? Thanks in advance.


You can not do that. You'll have to either change your markup or the CSS styles so that the image and span are correctly aligned in all browsers.

In case the image is the same for every link, another technique is to change the CSS style for the <a> tag, so that the image is set als left-aligned, unrepeated background image and a left padding pushes the text to the right so that the image is visible.

0

精彩评论

暂无评论...
验证码 换一张
取 消