寻找更好的方法来删除 IE6 的空白
目前,当我编写一个列表时,我这样做:
<ul><!--
--><li><a href="" title="">something</a></li><!--
--><li><a href="" title="">something</a></li><!--
--><li><a href="" title="">something</a></li><!--
--><li><a href="" title="">something</a></li><!--
--><li><a href="" title="">something</a></li><!--
--><li><a href="" title="">something</a></li><!--
--><li><a href="" title="">something</a></li><!--
--></ul>
<ul><!--
--><li><a title="" href="">something</a><!----></ul>
但是在具有更复杂的导航菜单的更大的网站上,这是不切实际的,并且代码看起来很分散等等......有谁知道一种方法来摆脱空白和保持干净的代码外观..我想我可能会问只是封装...这让我每个网站都感到困扰..
抱歉,这是一个不好的例子,它很难在这里正确格式化..
感谢您的回复,这是一篇一般兴趣类型的帖子.. 。 我要尝试 Ahsan Rathod 和 DanialB 的回复......
我担心我们的客户仍然使用这个浏览器(IE6),所以我们必须使用这个布满灰尘的浏览器。
下次我会发布 css,这次我没有这样做,这是值得的,因为我假设每个人都可能在某个时候为 IE6 编写代码并遇到了这个...
不过再次感谢您的所有回复..
currently when I code a list I do this:
<ul><!--
--><li><a href="" title="">something</a></li><!--
--><li><a href="" title="">something</a></li><!--
--><li><a href="" title="">something</a></li><!--
--><li><a href="" title="">something</a></li><!--
--><li><a href="" title="">something</a></li><!--
--><li><a href="" title="">something</a></li><!--
--><li><a href="" title="">something</a></li><!--
--></ul>
<ul><!--
--><li><a title="" href="">something</a><!----></ul>
but on much larger websites with much much more complicated navigation menu's this isnt practical and the code looks scattered etc..... does anyone know of a way to get rid of the white space and keep clean looking code.. I thought I might ask just encase... this bothers me every site..
sorry for a bad example its hard to format properly here..
Thanks for your replies, this was a general interest type post...
Im gonna try Ahsan Rathod's and DanialB's replies....
Im affraid our clients still use this browser (IE6) so we have to use this dusty ol'browser.
next time ill post css, this time I didnt this it was worth it as I assumed everyone probly coded for IE6 at somepoint and came across this...
Thanks again for all your replies though..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果将列表项设置为
inline
元素,则空白只会在列表中呈现。您可以使用浮动块来代替,并且不会出现空格。White spaces would only be rendered in lists, if you style the list items as
inline
elements. You could use floating blocks instead and no white spaces will occur.你有没有尝试过:
Have you tried :
您也可以尝试这种方法,尽管它也不理想。
需要考虑的一件事是,IE6 现在已经过时了,甚至微软也准备终止它。为一个已有 10 年历史的浏览器提供连续 3 个版本的调整真的值得吗?
You could also try this approach, though it's also not ideal.
One thing to consider, IE6 is ancient now, and even Microsoft are ready to pull the plug on it. Is making accommodations for a 10 year old browser with 3 successive versions really worth it?