我有点CSS问题。这发生在IE、FF和Chrome中。不过,在iPhone Safari浏览器上,它看起来很不错。问题是,第二个“block”span标记(id="myDiv"
)不像第一个block span标记那样向左浮动,它在某些类型的左边有一个填充,我从未应用过。如何删除id="myDiv"
span标记左侧的填充?
<head>
<style>
.plansHeader{
font-weight:bold;color:rgb(73,102,145);font-size:12pt;margin-bottom:6px;line-
height:14pt;
}
</style>
</head>
<body>
<span style="display: block">
<img src="http://m.v4m.mobi/uni/thumbs/arrow.png" border="none" style="vertical-align: middle; float: left;"/>
<span id="plansHeader">e-phone to e-phone calls: R0.40 p/m</span>
</span>
<span id="myDiv" style="display: block">
<img src="http://m.v4m.mobi/uni/thumbs/arrow.png" border="none" style="vertical-align: middle; float: left;" />
<span class="plansHeader">0 minutes call time included(to Any mobile/landline)</span>
</span>
</body>
谢谢你
最佳答案
在跨距后添加:
<div style="clear:both;"></div>
应该是这样的:
<span style="display: block">
<img src="http://m.v4m.mobi/uni/thumbs/arrow.png" border="none" style="vertical-align: middle; float: left;"/>
<span id="plansHeader">e-phone to e-phone calls: R0.40 p/m</span>
<div style="clear:both;"></div>
</span>
<span id="myDiv" style="display: block">
<img src="http://m.v4m.mobi/uni/thumbs/arrow.png" border="none" style="vertical-align: middle; float: left;" />
<span class="plansHeader">0 minutes call time included(to Any mobile/landline)</span>
<div style="clear:both;"></div>
</span>
记住:一定要清除漂浮物!
关于html - 元素没有像所指示的那样向左 float ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10981112/