Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do i center a background image in the <body> tag??

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
i really need to know how to cetner a background in the body tag, i tried <body background=&quot;picture.bmp&quot; align=&quot;center&quot;> but that didnt work

please help me
 
Hi,

To do that you will need CSS. Try:

Code:
BODY {
background-image: url();
background-repeat: no-repeat;
background-position: center;
background-position: middle;
}

Bye.
 
Hi,

background-position: middle; will not work I think?

background-position: center; is right.

add background-attachment: fixed; to make that with long scrollable pages the background won't scroll. Works only in IE.

add background-color: green; to set a color if your background image is small.

Good luck,
Erik
 
Hi,

The stuff I wrote 2 message back works in IE5.5. It might not be &quot;kosher&quot;, but it still works.

Bye.
 
Is there anyway to &quot;span&quot; the background 100% across the screen so it looks the same on different resolutions? also, is there a way to do that in tables cause i have 50 images or so that are, say, 100 pixels wide but i want to make them 150 pixels AS A BACKGROUND in a table. Any help would help. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top