Jump to content

vertical align


chiprivers

Recommended Posts

I have some text inside a div that I want vertically aligned in the middle of the div.

I have the CSS as this:

[code]
#file_name {
width: 100%;
height: 45px;
text-align: center;
background-color: #FFFFFF;
border: 1px solid #000000
}

.name {
font-family: arial;
font-size: 30px;
color: #000000;
font-weight: bold;
vertical-align: middle
}
[/code]

On my page I then have:

[code]
<div id="file_name">
<span class="name">Text here!</span>
</div>
[/code]

But the text is not aligning vertically in the middle of the box? Any reason why this is not working?
Link to comment
https://forums.phpfreaks.com/topic/30240-vertical-align/
Share on other sites

[quote author=ToonMariner link=topic=118192.msg482769#msg482769 date=1165856536]
you apply the vertical-allign property to the parent container. So in your case #file_name should have vertical_align: middle; This is a problem if you have other content you don't want to align in this manner...
[/quote]

I did think that but when I tried that it did not work either!
Link to comment
https://forums.phpfreaks.com/topic/30240-vertical-align/#findComment-139208
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.