Computing.Net > Forums > Web Development > Image in

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Image in

Reply to Message Icon

Name: malkovich
Date: October 10, 2009 at 10:32:31 Pacific
OS: Windows 7 x64
CPU/Ram: 4GB
Product: Custom / CUSTOM
Subcategory: HTML
Comment:

I'm trying to put a 84x80 image on the left of the text everytime I use <H1>, but I don't know how to get the text vertically aligned in the middle.
That's what I've got so far:

h1 {
background: url('images/icon.png') no-repeat;
background-position: left;
height: 80px;
padding-left: 84px;
vertical-align: middle; }

The vertical-align: middle; doesn't seem to be changing the position of the text. Anyone knows what I'm doing wrong?



Sponsored Link
Ads by Google

Response Number 1
Name: Radix-64
Date: October 11, 2009 at 13:18:25 Pacific
Reply:

Hi, perhaps try assigning a line-height as well. If you have only a single line of text that you want to center and you can specify a fixed-height for the parent element, then set the line-height of the parent element.

For example:

line-height: 500px;

or

line-height:5em


0
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Image in

Images in Pop-Ups www.computing.net/answers/webdevel/images-in-popups/1202.html

image in XML www.computing.net/answers/webdevel/image-in-xml/157.html

how to display images in PHP www.computing.net/answers/webdevel/how-to-display-images-in-php-/2164.html