2010-10-05 71 views

回答

1
.slogan { 
color:#143063; 
font-size:18px; 
**line-height:92px;** //Add this line without the asterisks(*) 
margin:auto; 
text-align:center; 
width:50%; 
} 
+0

作品谢谢 – samwick 2010-10-05 03:31:32

+0

Samwick你应该接受这个答案。你有60%的接受比率。不可怕,但... – Moshe 2010-10-05 03:33:46

+0

我越来越好的队友。在评论时,我试图接受答案,但杰夫的逻辑表示,我仍然需要等待X分钟。所以我去了,把垃圾拿出来 – samwick 2010-10-05 03:43:49

2

您需要将'text-align:center'添加到col3。

+0

似乎没有工作。尝试w /萤火虫 – samwick 2010-10-05 03:30:46

0

我看到你有一个div称为col3和嵌套式div归类slogan。这是我会怎么做的。

#col3 { 
    width: 100%; 
    text-align: center; 
} 
.slogan { 
    width: 600px; 
    margin: 0px auto; 
    text-align: left; 
} 

slogan应具有边缘固定宽度:0px auto的使其居中。

1
<style> 
    .col3{ 
     display:table-cell; 
     width:200px;height:200px; 
     text-align:center; 
     vertical-align:middle; 
     border:1px solid blue; 
    } 

    .col3 .slogan{ 
     border:1px solid red;width:100px;height:100px; 
     display:inline-block; 
    } 
</style> 

<div class="col3"> 
    <div class="slogan"> 
    </div> 
</div> 

你可以给任何高度或宽度COL3口号的CSS将使其居中对齐始终

你可以把任何元素内部的口号,这将是中心对齐:)