格式化组类和范围内的文本(对齐文本)

时间:2012-12-24 22:50:59

标签: html css format

我有这个HTML代码

<section class="group5">
    <p ><span class="purple">1)</span>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec molestie. Sed aliquam sem ut arcu. Phasellus sollicitudin. 
    Vestibulum condimentum  facilisis nulla. In hac habitasse platea dictumst. Nulla nonummy. Cras quis libero.</p>
    <p ><span class="purple">2)</span>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec molestie. Sed aliquam sem ut arcu. Phasellus sollicitudin. 
    Vestibulum condimentum  facilisis nulla. In hac habitasse platea dictumst. Nulla nonummy. Cras quis libero.</p>
    </section>

和这个css

p {
    margin-bottom:7px;      
    color:#161414;
    }

a, p a {
    text-decoration:underline;
    color:white;
    }
    a:hover {color:white;}

.group5 {
    float: left;
    width: 350px;
    position: relative;
    background:transparent;
    padding:15px;
    margin-bottom:10px;
    }

.purple{
    font-size:50px;
    color: #663366; 
    float:left;
    padding:12px;
    margin:20px;
}

我如何格式化段落,我的意思是为段落中的文字辩护?

我收到以下未格式化的结果

enter image description here

我正在阅读

 div
{
text-align:justify;
text-justify:inter-word;
}

但这只适用于IE ...

2 个答案:

答案 0 :(得分:1)

解决方案是

p {
    margin-bottom:7px;
    text-align: justify; 
    color:#161414;
}

答案 1 :(得分:0)

您也可以使用

<p align="justify">.. . . . . . . </p>