如何将正文文本div居中?

时间:2014-09-19 18:16:16

标签: html css

我发现了如何将页面标题居中,但无法弄清楚如何将包含摘要描述文本的div(包装摘要描述)居中。

如果你看看我的jsfiddle(http://jsfiddle.net/huskydawgs/L19g6jk6/),你会看到谈论斯巴鲁森林人的文字目前在左边。我希望那个div能够居中。

我该怎么做?

这是我的傻瓜:http://jsfiddle.net/huskydawgs/L19g6jk6/

这是我的代码:

    <div class="products-intro-1st rtecenter">
    <h2 class="section-title blue"> 
        <span class="section-title-bold">Subaru</span> Forester</h2>
</div>
<div class="wrapper-summary-description rtecenter">
<p class="summary-description">
    The Subaru Forester is a compact crossover manufactured since 1997 by Fuji Heavy Industries and sold under the Subaru brand. Available in Japan from 1997, the Forester shares its platform with the Impreza. It was introduced in 1997 as a compact crossover wagon. It has been crowned Motor Trend's 2014 SUV of the Year and The Car Connection's Best Car To Buy 2014
</p>
</div>

这是我的css:

.products-intro-1st {
margin: 50px 0 0 0;

}

h2.section-title {
    font-family: SegoeRegular, Helvetica, Arial;
    font-size:32px;
    font-weight: normal;
    margin: 10px 0 50px 0;
    border-bottom: 1px dotted #f66511;
    padding:0 0 5px 0;
}

h2.section-title-bold {
    font-weight: bold;
}

.wrapper-summary-description {
    position:relative;
    width:540px;
    border: none;
    margin: 40px 0 0 0;
    overflow: hidden;
}

.summary-description {
        color: #232323;
        font-family: Helvetica, Arial, sans-serif;
        font-size: 14px;
        line-height: 25px;
        margin: 0;
        text-align: left;
}

.rtecenter {
    text-align:center
}
.blue { color: #2251a4; }

1 个答案:

答案 0 :(得分:3)

.wrapper-summary-description {
    margin: 0 auto;   
}