HTML help?

Phili

Member
Jan 6, 2005
36
0
0
Hey,
how do I align my background picture to the top, right?

Thank you very much!
 

wkinney

Senior member
Dec 10, 2004
268
0
0
You will need a combinaton of javascript and CSS.
body {
background: #FFFFFF url(images/mybgimage.jpg) no-repeat;
background-position: Zpx 0px;
}

where Z variable is the correct offset to match the users resolution, which is avaiable in javascript via screen.width variable.
Or an easier approach would be to use the server side scripting language (PHP, ASP, etc) to write the appropriate offset to the CSS body tag.
There are other approaches, such as aligning a <div> to the right, and putting its background to your desired image, but this has mixed results...
 

stndn

Golden Member
Mar 10, 2001
1,886
0
0
actually, you can do it simply with CSS alone:

body
{
background: #ffffff url(images/bgimage.jpg) no-repeat top right;
}
 

screw3d

Diamond Member
Nov 6, 2001
6,906
1
76
Originally posted by: stndn
actually, you can do it simply with CSS alone:

body
{
background: #ffffff url(images/bgimage.jpg) no-repeat top right;
}

:thumbsup: This is completely a client-side thing. No need to touch any server-side stuff