473,395 Members | 1,571 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

CSS Button text centered vertically

Hello,

I want to make a button that automatically resizes according to the
text length and the font size (which can be changed in firefox pretty
easily with the browser).

The button already works for resizing horizontally, the problem is
when I enlarge the text using firefox, the text doesnt stay aligned
with the button. If the text is larger, the text is not centered
vertically in the button.

Here is my code,
http://mofstudios.com/maxime/test/test.html

I need a solution that the text will stay centered in the button
whatever size the text is.
It also needs to work in IE

Thank you for helping me
Max
Feb 8 '08 #1
1 5618
Maxime wrote:
>
when I enlarge the text using firefox, the text doesnt stay aligned
with the button. If the text is larger, the text is not centered
vertically in the button.

http://mofstudios.com/maxime/test/test.html
It's only doing what you told it to do:
background: url(./images/btny_l.gif) no-repeat left top;

Notice the "top" vertical position.
I need a solution that the text will stay centered in the button
whatever size the text is.
I don't think you can do it with the single image you're using for both
normal and :hover states. Make 2 images, one for each state, and
vertically position it center instead of top.

--
Berg
Feb 8 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Wilhelm Kutting | last post by:
Hi i want to use the following layout: ----------------- | | | | Text line 1 | | | Text line 2 | image.jpg | | ... | | | | | |
6
by: Jerry Camel | last post by:
I want to center an image on the screen and have text centered over the image. What's the best way to do this? I've been playing with style tags and I can get the stuff to center automatically...
4
by: tomasio | last post by:
Dear NG-Readers, It's me again on my long road to perfection. I would like to center the copy text between the two large arrows vertically when there is not enough text to fill "copy"-div. It...
18
by: ~john | last post by:
Sorry if this is a dumb question buy my CSS is pretty bad... but how do I get text to center vertically within a div tag? Here's my code below... the text is displaying on the far top-right. I...
0
by: pamelafluente | last post by:
Hello experts, I need some help to do in a proper way what I am doing. I have some "cells" in a web page. Each "cell" is made of 2 DIV. One is inside the other. Example with 2 "cells" : <div...
4
by: avi | last post by:
Hello, I am trying to vertically center text in a background image, I found a solution on this site that sets the line-height to the height of the background image. This works just fine, except...
1
by: StickMaker | last post by:
On my page at http://www.sticksite.com/grizzly/ I want all the images down the left side with the relevant text vertically centered beside each image. NO tables; CSS only. The only way I can get it...
1
by: JackRbt | last post by:
I can do that if they're in a cell, but they're not. With CSS, I can center horizontally. Can I have text with is to the left of a textarea, and have the text vertically centered with respect to...
7
by: Bram2 | last post by:
Sorry if this sounds like a dumbass newbie question. I'm getting crazy or something, but somehow I can't get this simple thing to work: 1. In general, how do I center text and/or images...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.