jasonc Posted March 10, 2010 Share Posted March 10, 2010 I can not get the text to be centered vertically please can some tell me what is wrong with what i am using. #font.verticalalign { vertical-align:middle; } <font class="verticalalign">Welcome to our site</font> Quote Link to comment https://forums.phpfreaks.com/topic/194750-i-can-not-get-the-text-to-be-centered-vertically/ Share on other sites More sharing options...
haku Posted March 10, 2010 Share Posted March 10, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/194750-i-can-not-get-the-text-to-be-centered-vertically/#findComment-1024128 Share on other sites More sharing options...
jasonc Posted March 10, 2010 Author Share Posted March 10, 2010 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.. #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; } <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 --> Quote Link to comment https://forums.phpfreaks.com/topic/194750-i-can-not-get-the-text-to-be-centered-vertically/#findComment-1024143 Share on other sites More sharing options...
XeNoMoRpH1030 Posted March 10, 2010 Share Posted March 10, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/194750-i-can-not-get-the-text-to-be-centered-vertically/#findComment-1024336 Share on other sites More sharing options...
patriklko Posted April 17, 2010 Share Posted April 17, 2010 just add the vertical align property to the container in which the text is written, this will solve your problem... Quote Link to comment https://forums.phpfreaks.com/topic/194750-i-can-not-get-the-text-to-be-centered-vertically/#findComment-1043606 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.