473,320 Members | 2,088 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,320 software developers and data experts.

vertical align text via CSS?

Sorry to re-post, but my original post didn't seem to appear. Here it is
again:

I am experimenting with a roll-over but am struggling to get the text to
align, vertically, in the middle:

#sidebar a:link, #sidebar a:visited {
border: 1px solid #7A95CA;
display: block;
height: 30px;
text-decoration: none;
color: #7A95CA;
padding: 0px 6px 0px 14px;
}

#sidebar a:hover, #sidebar a:active {
border: 1px solid #7A95CA;
height: 30px;
text-decoration: underline;
color: #FFFFFF;
padding: 0px 6px 0px 14px;
background-color: #7A95CA;
}

I have set the height to 30px, but the text appears to be aligning to the
"top" by default.
I've tried adding:
vertical-align: middle;
....but this isn't working.

Any ideas?

Also, is there anywhere on the web I could access a chart of CSS commands?
Thanks.
Nath.
Feb 3 '06 #1
2 1629
Els
tradmusic.com wrote:
I am experimenting with a roll-over but am struggling to get the text to
align, vertically, in the middle:

#sidebar a:link, #sidebar a:visited {
border: 1px solid #7A95CA;
display: block;
height: 30px;
text-decoration: none;
color: #7A95CA;
padding: 0px 6px 0px 14px;
}

#sidebar a:hover, #sidebar a:active {
border: 1px solid #7A95CA;
height: 30px;
text-decoration: underline;
color: #FFFFFF;
padding: 0px 6px 0px 14px;
background-color: #7A95CA;
}

I have set the height to 30px, but the text appears to be aligning to the
"top" by default.
I've tried adding:
vertical-align: middle;
...but this isn't working.
Correct ;-)
Any ideas?


Set line-height equal to height.
Not a good idea if there is a chance of wrapping lines though.
Also, if you set the height/line-height in pixels, stuff might become
unreadable when resizing the font in the browser. Better use .em for
the height and line-height to let it grow/shrink with user font-size
setting.

--
Els http://locusmeus.com/
accessible web design: http://locusoptimus.com/
Feb 3 '06 #2
tradmusic.com wrote:

(snip)
Also, is there anywhere on the web I could access a chart of CSS commands?
Thanks.
Nath.

Nath,

Correct terminology is important.

CSS has 'selectors', which determine which objects a set of style
'properties' will apply to.

Everything you wanted to know about selectors is at
http://www.w3.org/TR/CSS21/selector.html.

The chart of CSS properties is at http://www.w3.org/TR/CSS21/propidx.html.

Chris Beall

Feb 3 '06 #3

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

Similar topics

3
by: kAldam | last post by:
I am currently using IE 6.0 and 5.5 and the scenario is the following. I have a span that contains text, and the span is beign contained by a table cell (this is the way thing need to be in my...
8
by: abracad | last post by:
Hi Is it possible to vertically align an image in the middle of a DIV of fixed height?
10
by: Markus Ernst | last post by:
Hi I have a strange problem with vertical-align. The case can be viewed at http://www.brainput.info/geschichte.html. HTML code: <div id="bild"><img src="geschichte.gif" width="274"...
1
by: Kenneth | last post by:
Okay, I've been scouring Google for hours looking for a solution to this problem, but as of yet I can't find one. XHTML Transitional seems to specify that I can no longer set a table's height to...
2
by: Eric Lindsay | last post by:
If I want to have the middle of an image vertically aligned with the middle of a heading (or several lines of heading), is there some particular way people would recommend? vertical-align: center...
4
by: shivas | last post by:
Hi, I am using vertical-align for a table row, but the Image and the text are not aligned properly. I don't what to align image in the img tag, rather in the row itself I want to align. I want...
3
by: acunnon | last post by:
I am trying to put together an login page my problem is getting the three items aligned to the middle verticaly without specifing a height to anything on the page. CSS html{ height:100%;...
2
by: esteuart | last post by:
I need to get the right combination for a div to clip any text inside and allow vertical alignment. I only have this problem in FireFox. I have 3 divs nested within each other. The outer div has...
8
by: ayamopamo | last post by:
Hi- I am trying to center a web page. It seems like this should be very simple to do, but apparently it isn't my day. I have successfully centered the background by calling it in the css body tag:...
40
by: maya | last post by:
hi, how do I get text to vertical-align inside a div? http://www.mayacove.com/misc/home.html vertical-align should work, according to this:...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.