Author Topic: I can not get the text to be centered vertically  (Read 480 times)

0 Members and 1 Guest are viewing this topic.

Offline jasoncTopic starter

  • Devotee
  • Posts: 817
    • View Profile
I can not get the text to be centered vertically
« on: March 10, 2010, 03:34:30 AM »
I can not get the text to be centered vertically

please can some tell me what is wrong with what i am using.

Code: [Select]
#font.verticalalign { vertical-align:middle; }
Code: [Select]
<font class="verticalalign">Welcome to our site</font>

Offline haku

  • Guru
  • Freak!
  • *
  • Posts: 5,707
  • Old Man
    • View Profile
Re: I can not get the text to be centered vertically
« Reply #1 on: March 10, 2010, 03:44:15 AM »
1) You can't add CSS to font tags
2) Font tag is deprecated. You should only add CSS
3) You can't really vertically center stuff with CSS

Offline jasoncTopic starter

  • Devotee
  • Posts: 817
    • View Profile
Re: I can not get the text to be centered vertically
« Reply #2 on: March 10, 2010, 04:20:56 AM »
thanks for you reply.

you say it i can not really do this.

but how would i vertically center the text, how ever it is done.

this is what i have..

Code: [Select]
#container { padding: 0; width: 100%; text-align: middle; }
#left { float: left; }
.clear { height: 0; font-size: 1px; margin: 0; padding: 0; line-height: 0; clear: both; }

#div.verticaltext { vertical-align:middle; }

Code: [Select]
<div id="container">
  <div id="left">
   <img src="logo.jpg">
  </div><!-- left -->
  <div id="verticaltext">
      <font size="40pt">Welcome to <?=$sitename;?></font>
  </div><!-- right -->
  <div class="clear"></div>
 </div><!-- container -->

Offline XeNoMoRpH1030

  • Enthusiast
  • Posts: 71
    • View Profile
    • Blue Line Attack
Re: I can not get the text to be centered vertically
« Reply #3 on: March 10, 2010, 01:15:00 PM »
1) You can't add CSS to font tags
2) Font tag is deprecated. You should only add CSS
3) You can't really vertically center stuff with CSS

1) Of course you can
2) But, since it is deprecated, I guess you wouldn't be using it anyway
3) Agreed

But, there are ways. Check out here.

Offline patriklko

  • Irregular
  • Posts: 20
    • View Profile
Re: I can not get the text to be centered vertically
« Reply #4 on: April 17, 2010, 03:51:23 AM »
just add the vertical align property to the container in which the text is written, this will solve your problem...