【发布时间】:2015-01-08 03:37:50
【问题描述】:
这是一个简单的 CSS 问题,但我还不知道。我有几个带有背景颜色的 p 标签,我的问题是背景在每个标签中都延伸到屏幕的 100%,我只想包装单词,将效果创建为按钮或块。我不明白为什么 p 背景会变宽。
<div class="process_wrapper_mobile">
<div class="inter_mobile_process">
<p>Interview</p>
</div>
<div class="inter_mobile_process">
<p>Data reception</p>
</div>
<div class="inter_mobile_process">
<p>Design</p>
</div>
CSS:
.process_wrapper_mobile {
position: relative;
float: left;
width: 100%;
height: auto;
background-color: #CCC;
}
.process_wrapper_mobile .inter_mobile_process {
position: relative;
float: left;
width: 100%;
height: auto;
margin-bottom: 3%;
}
.process_wrapper_mobile .inter_mobile_process p {
text-align: center;
color: #fff;
font-size: 0.9em;
background-color: #333;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
padding: 3% 5%;
}
请检查我的小提琴。
谢谢!
【问题讨论】:
标签: css position width centering word-wrap