Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Vertical Aligning Center for Text?
Old 10-07-2007, 05:15 AM Vertical Aligning Center for Text?
Novice Talker

Posts: 7
Trades: 0
How can I center the text (http:// part)

I have this as the css part but it doesn't seem to work for me

Code:
#address_box{
background:url(./images/address.gif) no-repeat;
width: 336px;
height: 46px;
border: none;
font-family: Tahoma;
font-size: 16px;
color: #808080;
line-height: 46px;
vertical-align: middle;
}
Or is there something else I have to add to the CSS?

http://www.proxyforward.com/

Thanks,
Guo Hong
Guo Hong is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-07-2007, 12:56 PM Re: Vertical Aligning Center for Text?
coolkbk585's Avatar
Be good this Christmas!

Latest Blog Post:
KBlog has been deativated
Posts: 642
Name: Kyle
Location: Ada, MI
Trades: 0
Instead of the putting the vertical-align on the container, put it on the actual element (whether it's a span, or text, or whatever).
__________________
<?php if($Adsense_Revenue > 0): define('HAPPINES','100%'); else: define('HAPPINESS', '0%') endif; ?>
coolkbk585 is offline
Reply With Quote
View Public Profile Visit coolkbk585's homepage!
 
Old 10-07-2007, 01:01 PM Re: Vertical Aligning Center for Text?
Novice Talker

Posts: 7
Trades: 0
If it is text, how can I go about doing it?

Thanks,
Guo Hong
Guo Hong is offline
Reply With Quote
View Public Profile
 
Old 10-07-2007, 03:11 PM Re: Vertical Aligning Center for Text?
joder's Avatar
Flipotron

Posts: 6,442
Name: James
Location: In the ocean.
Trades: 0
Why did you make the text area so much larger than the text?
joder is offline
Reply With Quote
View Public Profile
 
Old 10-07-2007, 08:34 PM Re: Vertical Aligning Center for Text?
coolkbk585's Avatar
Be good this Christmas!

Latest Blog Post:
KBlog has been deativated
Posts: 642
Name: Kyle
Location: Ada, MI
Trades: 0
Well, if you're just going to put some text inside that div then just put a span around it.

HTML Code:
<style type="text/css">
#address_box{
background:url(./images/address.gif) no-repeat;
width: 336px;
height: 46px;
border: none;
font-family: Tahoma;
font-size: 16px;
color: #808080;
line-height: 46px;
}

#address_text {
 vertical-align: middle;
}
</style>


<div id="address_box">

     <span id="address_text">The text here</span>

</div>
__________________
<?php if($Adsense_Revenue > 0): define('HAPPINES','100%'); else: define('HAPPINESS', '0%') endif; ?>
coolkbk585 is offline
Reply With Quote
View Public Profile Visit coolkbk585's homepage!
 
Old 10-08-2007, 07:29 AM Re: Vertical Aligning Center for Text?
Novice Talker

Posts: 7
Trades: 0
Thanks, I appreciate it a lot but actually I am having a form for that container so I have this

HTML Code:
<form method="post" action=".....">
<input id="address_box" type="text" name="....." value="http://">
</form>
So actually I have no idea how to vertical center the text in this case as I cannot define another span to be used inside.

@joder, it was suppose to be design of the template but thanks, I will take note of it in the future.
Guo Hong is offline
Reply With Quote
View Public Profile
 
Old 10-08-2007, 02:55 PM Re: Vertical Aligning Center for Text?
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
vertical-align doesn't work in CSS they way it does in tables. It refers to the baseline of the text - not it's position inside a div.

There is no easy way to vertically align in CSS, there are a few workaround, like the 'shiv div' method or the 50% margin method.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Vertical Aligning Center for Text?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.05614 seconds with 12 queries