Click here to Skip to main content
15,889,879 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi How set words in center of div tag,the following is my html code

HTML
<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 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
Posted

1 solution

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.:

XML
<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>


Regards,

— Manfred
 
Share this answer
 
v3
Comments
CHill60 12-Jun-13 6:35am    
Manfred - I think you forgot to put the link in to the article :-)
Manfred Rudolf Bihy 12-Jun-13 6:48am    
:blush:

My bad! I'll fix it in a jiffy!

Cheers!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900