我是CSS的新手.我刚刚开始了我的第一个网站,几乎完成了登陆页面.但是,我遇到了两个问题,但仍未找出根本原因.我创建了一个plukr链接http://plnkr.co/edit/aH8LfC?p=preview.
CSS类.三个div框的代码:
<div class="container info-box clearfix">
<div class="col3">
<h3>Investment Planning</h3>
<p>Money Plant Services is one of the premier Investment advisory Firm known for making taxation & investing simpler and more understandable and profitable for the clients. Currently serving more than 5000 Individual customers with corporate tie ups.</p>
</div>
<div class="col3">
<h3>Wealth Management</h3>
<p>Money Plant Services is one of the premier Investment advisory Firm known for making taxation & investing simpler and more understandable and profitable for the clients. Currently serving more than 5000 Individual customers with corporate tie ups.</p>
</div>
<div class="col3">
<h3>Risk Management</h3>
<p>Money Plant Services is one of the premier Investment advisory Firm known for making taxation & investing simpler and more understandable and profitable for the clients. Currently serving more than 5000 Individual customers with corporate tie ups.
</p>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
.info-box{
width:100%;
margin-top: 20px;
}
.col3{
width: 30%;
float: left;
margin: 10px;
padding: 5px 10px;
background-color: #FCFCFC;
border-radius: 2px;
box-shadow: 0 0 4px #DDDDDD;
}
Run Code Online (Sandbox Code Playgroud)
谁能帮助我理解我哪里出错了.我没有使用Bootstrap/Foundation框架,因为我需要掌握纯CSS.
注意:必须在完整窗口中加载网页才能查看问题.
此致,普拉迪普
除非您添加此CSS,否则此溢出是由左/右填充引起的,这些填充不包含在宽度中:
* {
box-sizing: border-box;
}
Run Code Online (Sandbox Code Playgroud)
这意味着(100px宽度)您的元素大小将100px 从左边框到右边框.如果你设置了15px填充,你将拥有:
如果保留默认值box-sizing,您将拥有: