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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.