如何设置中心ot div标签中的单词?顶部,底部和左侧和右侧
问题描述:
嗨
如何在div标签的中心设置单词,以下是我的html代码
Hi
How set words in center of div tag,the following is my html code
<div style="width: 100%; background-color: #308542; text-align: center; color: #FFFFFF; border-bottom-color :#308542;
font-size: 12px; font-family: Arial; height: 74px;">
<br />
© All Rights Reserved 2013. <br />
</div>
i给div标签高度74px,我的问题是这个词出现在顶部而不是中间,我的意思是在顶部和底部之间,左右之间它确定。
i意味着74px高度在div标签中给出4到5行,单词出现在第1行不在中间行,这里我提到行是理解目的
请回复asap
Thanx
Aravind
i give height 74px for div tag,my problem is the word appear on the top not in the middle,i mean in between top and bottom,between left and right it ok.
i mean 74px height give 4 to 5 lines in div tag and word appear in 1st line not in middle line ,here i mention line is understanding purpose
pls reply asap
Thanx
Aravind
答
- Manfred
这是一个很好的解释为什么vertical-align很可能不会做一个无辜的头脑可能怀疑的事情:理解垂直对齐,或如何(不)垂直居中内容 [ ^ ]
该网站还提供了一些如何实现相同的示例,例如:
Here is a great explanation why vertical-align will most probably not do what an innocent mind might suspect: Understanding vertical-align, or "How (Not) To Vertically Center Content"[^]
The site also sports some samples of how to achieve the same e.g.:
<style type="text/css">
#myoutercontainer { position:relative }
#myinnercontainer { position:absolute; top:50%; height:10em; margin-top:-5em }
</style>
...
<div id="myoutercontainer">
<div id="myinnercontainer">
<p>Hey look! I'm vertically centered!</p>
<p>How sweet is this?!</p>
</div>
</div>
问候,