Examples *{margin: 0;padding: 0;}.box{ padding: 10px 20px; background: red; color: #fff; text-decoration: none; float: left;}.ico{ width: 20px; height: 20px; background: blue; float: right;} 怎么破
在IE 6 7下撑开了, 其他正常 不想让它撑开. a 宽度不固定 i 在右边.
怎么破?
求解?
可以给文字外再包一层 可以解决 ,如果是这种结构的话有没有其他方法可以解决
回复讨论(解决方案)
你的父元素,非得用float吗?
a标签
display:block
试试看
a标签
display:block
试试看
不行
加个宽度。
demo here.
Examples *{margin: 0;padding: 0;} .box{ padding: 10px 20px; background: red; color: #fff; text-decoration: none; float: left; width:78px; } .ico{ width: 20px; height: 20px; background: blue; float: right; } .txt{ float:left;} 怎么破
.ico{ width: 20px; height: 20px; background: blue; display:inline-block;}
子和父样式中添加position:absolute;同时在子样式中加入right:**px;(宽度自己定义)
查看更多关于IE6浮动撑开了父元素,怎么破?_html/css_WEB-ITnose的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did113345