在pc端中,要写4个盒子,每个盒子间隔10px,水平平均发布,,试了多种方法都达不到效果,求助
.wrap{ovverflow:hidden;width:100%}
.wrap div{width:calu(100% - 30px)/4; float:left;height:100px}
.wrap div+div{margin-left:10px;}
标签结构自己写吧
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
*{
margin:0;
padding:0;
}
html,body{
width:100%;
height:100%;
}
.wrap{ovverflow:hidden;width:100%}
.wrap div{ background-color:yellow;
width:calc( (100% - 30px)/4);
float:left;height:100px}
.wrap div+div{margin-left:10px;}
</style>
</head>
<body>
<div class="wrap">
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</body>
</html>
在PC端不要求兼容性的情况下可以使用弹性盒子模型flex,或者栅格布局grid;在要求兼容性的情况下可以设置外层div margin:0 auto,内层四个div display:inline-block并margin:10px
3 回答896 阅读✓ 已解决
4 回答1.3k 阅读✓ 已解决
2 回答926 阅读✓ 已解决
2 回答1.5k 阅读✓ 已解决
2 回答1.3k 阅读✓ 已解决
2 回答897 阅读✓ 已解决
2 回答1.1k 阅读✓ 已解决
仿bootstrap