关于栅格布局样式问题。

https://img2.mukewang.com/5c677fed0001a7b308000121.jpg

中间那7个图标应该怎么写?
PSD的宽度是1440 然后中间白色主题部分是栅格布局 左9 由3 的 左边导航宽是 230
那么这7个图标如何自适应 宽度写死吗 pad宽度是80*80的。

我写了7个li左浮动然后用calc( 100% / 7) 写的 但是太宽的 里面的文字图片文字又少。
现在应该怎么写呢 
或者是随着屏幕增大变多怎么写呢。 
是要li 转为行元素 然后宽度固定吗?但是这样最后一个 宽度不够会很空
要怎么做。 没有头绪。

https://img.mukewang.com/5c677ff5000143d302000099.jpg

https://img1.mukewang.com/5c677ff60001e46101820089.jpg

https://img1.mukewang.com/5c677ff7000101e408000103.jpg


不负相思意
浏览 581回答 1
1回答

aluckdog

试试用 text-align: justify;吧,宽度不用写死,百分比也行,其实还是比较推荐用js控制计算的,.mybox的padding可以用calc计算,当然你要兼容ie8还是用js计算吧<!DOCTYPE html><html><head>&nbsp; &nbsp; <meta charset="UTF-8">&nbsp; &nbsp; <meta name="viewport" content="width=device-width, initial-scale=1.0">&nbsp; &nbsp; <meta http-equiv="X-UA-Compatible" content="ie=edge">&nbsp; &nbsp; <title>Document</title>&nbsp; &nbsp; <style type="text/css">&nbsp; &nbsp; *{&nbsp; &nbsp; &nbsp; &nbsp; margin: 0;&nbsp; &nbsp; &nbsp; &nbsp; padding: 0;&nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp;.mybox{&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;width: 800px;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;border: 1px solid&nbsp; #000000;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;height: 500px;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;text-align: justify;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;text-justify: inter-ideograph;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;padding: 100px;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}&nbsp; &nbsp; &nbsp; &nbsp;.mybox:after{&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; content: '';&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; width: 100%;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; position: relative;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; display: inline-block;&nbsp; &nbsp; &nbsp; &nbsp;}&nbsp; &nbsp; &nbsp; &nbsp;.mybox .box{&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;width: 12.5%;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;background: red;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;display: inline-block;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;position:relative;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}&nbsp; &nbsp; &nbsp; &nbsp;.box:before{&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; content: '';&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; padding-top: 100%;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; box-sizing: border-box;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; display: block;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; width: 0;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; .pox{&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; position:absolute;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; height:100%;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; width:100%;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; left: 0;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; top: 0;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; border: 1px solid red;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; box-sizing: border-box;&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; </style></head><body>&nbsp; &nbsp; &nbsp; &nbsp; <body&nbsp; >&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class="mybox">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class="box"><div class="pox"></div></div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class="box"><div class="pox"></div></div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class="box"><div class="pox"></div></div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class="box"><div class="pox"></div></div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class="box"><div class="pox"></div></div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </body>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</body></html>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript