我一直在擺弄框內的文本一段時間,我注意到當屏幕調整框的頂部時,即使它不在代碼中,也總是添加這個額外的填充。是否有任何提示可以使屏幕尺寸在屏幕調整大小時不添加額外的填充?簡單的文本格式框內問題
* {
box-sizing: border-box;
}
/* Create three columns of equal width */
.columns {
float: left;
width: 33.3%;
padding: 8px;
}
/* Style the list */
.price {
list-style-type: none;
border: 1px solid #eee;
margin: 0;
padding: 0;
-webkit-transition: 0.3s;
transition: 0.3s;
}
/* Add shadows on hover */
.price:hover {
box-shadow: 0 8px 12px 0 rgba(0,0,0,0.2)
}
/* Pricing header */
.price .header {
background-color: #111;
color: white;
font-size: 25px;
}
/* List items */
.price li {
border-bottom: 1px solid #eee;
padding: 20px;
text-align: center;
}
/* Grey list item */
.price .grey {
background-color: #eee;
font-size: 20px;
}
/* The "Sign Up" button */
.button {
background-color: #4CAF50;
border: none;
color: white;
padding: 10px 25px;
text-align: center;
text-decoration: none;
font-size: 18px;
}
/* Change the width of the three columns to 100%
(to stack horizontally on small screens) */
@media only screen and (max-width: 600px) {
.columns {
width: 100%;
}
}
Try it Yourself »
<div class="columns">
<ul class="price">
<li class="header">Basic</li>
<li class="grey">$ 9.99/year</li>
<li>10GB Storage</li>
<li>10 Emails</li>
<li>10 Domains</li>
<li>1GB Bandwidth</li>
<li class="grey"><a href="#" class="button">Sign Up</a></li>
</ul>
</div>
<div style="position:relative;">
<div style="color:#ddd;background-color:#282E34;text-align:center;padding:20px 20px;text-align: justify;">
<H2 ALIGN="CENTER">PLAN IT</H2><BR>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsu </p>
</div>
</div>
僅供參考我相信'align'屬性自HTML5以來已被棄用 - 您可能希望考慮使用CSS集中對齊'H2'元素。 –
我修改了我的示例以顯示添加的填充。調整頁面大小,你會看到 – Vzupo