【发布时间】:2015-05-27 08:47:06
【问题描述】:
我希望我的“body2”div 位于页面中心,段落向左浮动。但是我的代码在两次潜水中都应用了中心对齐属性。 我在 CSS 中使用 float left 作为 para 但没有解决方案。
<div class="row body2" align="center">
<div class="writing">
<div class="date">13.01.15</div><br>
<div class="heading">My biggest audio project ever.</div>
<div class="container-fluid">
<div class="para">The complete setup took about 6 hours. We were extremely contended with the result taken into the account of everything is new. A late
</div><br><br>
</div>
</div>
</div>
CSS:我正在使用 text-align:left 使我的段落左对齐,但它显示居中对齐。
.body2
{
background-color: black;
margin-top: -10px;
margin-left: auto;
margin-right: auto;
}
.writing
{
margin-top:64px ;
margin-left: 88px;
padding-bottom: 50px;
}
.date
{
color: #716558;
font-family: myrid Pro;
font-size: 20px;
}
.heading
{
font-family: georgia;
font-size: 36px;
}
.para
{
margin-top: 40px;
line-height: 170%;
text-align:left;
}
【问题讨论】:
-
请包含你的css
-
请将您的代码发布到codepen.io 或jsfiddle.net,以便我们查看您的代码并帮助您修复它。
-
只是一点建议。对段落使用
<p>标签。 -
感谢@jojo 我会关注
-
如果您使用 align="center" 这将使您的 div 居中并同时将您的文本居中,以覆盖它,将文本设置为您的样式
.body2{text-align:left}检查here