用CSS调整div来填充父容器的宽度

用CSS调整div来填充父容器的宽度,第1张

用CSS调整div来填充父容器的宽度

在此线程中查看三十点的答案,以获得不带Javascript的纯CSS / HTML解决方案,该解决方案可在 包括IE 6在内的 所有浏览器中使用。

HTML:

<div id="container">    <div ></div>    <div ></div>    <div ></div>    <div ></div>    <span ></span></div>​

CSS:

#container {    border: 2px dashed #444;    height: 125px;    text-align: justify;    -ms-text-justify: distribute-all-lines;    text-justify: distribute-all-lines;        min-width: 612px;}.box1, .box2, .box3, .box4 {    width: 150px;    height: 125px;    vertical-align: top;    display: inline-block;    *display: inline;    zoom: 1}.stretch {    width: 100%;    display: inline-block;    font-size: 0;    line-height: 0}.box1, .box3 {    background: #ccc}.box2, .box4 {    background: #0ff}



欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5621322.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-15
下一篇 2022-12-15

发表评论

登录后才能评论

评论列表(0条)

保存