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
Vertically Centering Text in a Button
Old 10-15-2007, 08:45 PM Vertically Centering Text in a Button
Extreme Talker

Posts: 238
Location: United States
Trades: 0
I have a "button" that consists of a <span> with a background image and a link. I would like to center that text (currently it is always near the bottom). It only needs to be moved a few pixels, but the problem is that the top margin doesn't seem to be able to be changed for inline elements.. I know of the 50% margin vertical alignment CSS hack, but I don't really need it vertically aligned (just moved up a few static pixels), and I certainly don't want the extra markup in my HTML or hacks in my CSS, so does anyone know of simple solution?
__________________
The interlocking pieces of web development: usability, performance, accessibility, and standards.
frost is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-15-2007, 08:50 PM Re: Vertically Centering Text in a Button
coolkbk585's Avatar
Be good this Christmas!

Latest Blog Post:
KBlog has been deativated
Posts: 642
Name: Kyle
Location: Ada, MI
Trades: 0
You mean a button that's a link? Why not just make it into a REAL button from a form?

What does it do?
__________________
<?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-15-2007, 09:05 PM Re: Vertically Centering Text in a Button
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
Did you try adding some bottom padding to the <a> ?
__________________
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
 
Old 10-15-2007, 11:40 PM Re: Vertically Centering Text in a Button
Extreme Talker

Posts: 238
Location: United States
Trades: 0
@Kyle, it's not a submit button, and it's not being used for a form. It's a just a background and some text made to look like a button being used for some particular links.

@LadynRed, adding the padding to the <a> didn't work, but adding it to the <span> did work. I'm not sure why one worked and not the other. Adding the padding to the span messes up things with IE 7 though, due to the way I have my background set up (it's a fluid width button with transparent rounded corners). Anyways, thanks for the tip, I think I can make it work.
__________________
The interlocking pieces of web development: usability, performance, accessibility, and standards.
frost is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Vertically Centering Text in a Button
 

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 0.28721 seconds with 12 queries