Jump to content
Stef's Coding Community
amitte

need help with- positioning IMG BG in the div

Recommended Posts

hy...

 

i'm trying to put an image in my background but i run into a major prob-

 

well... i pot my img in one of my "div"s. and like u said in the article

 

"http://www.killersites.com/articles/newsletterArchive/Newsletter_March17_2004.htm"

 

i put all the values (background-image/repeat/attachment)...

 

and my prob is with the position!!!

 

i set it at "top left"

 

well.. i do get it on the top left... but of the whole page!! and i want it only at the top left of

 

my special div....

 

i tried margin's and padding's of the hole

and the div.... but nothing worked....

 

i need your help... pleas...

 

thanks in advance..

 

amit

 

p.s-

 

i use an external CSS file for this. like u said. and i put al the values in the relevent ID of the div....

 

thanks.

Share this post


Link to post
Share on other sites

first of all- thanks for the fest answer...

 

 

-----------------------

 

 

try try

 

 

 

 

#main {

 

position: absolute;

 

width: 550px;

 

height: 500px;

 

margin-right=400px;

 

background-attachment: fixed;

 

background-image: url(img/bg1.jpg);

 

background-repeat: no-repeat;

 

background-position: top left;

 

}

 

 

--------------------this is the relevent part... if u need more let me know...

Share this post


Link to post
Share on other sites

Try this: Put your whole site into a div. I call that a wrapper.

 

html

 




Try Try


 

css

 

#wrapper{
   margin:0 auto;
   width:800px;
   height:auto;
}
#main {
   position: absolute;
   width: 550px;
   height: 500px;
   margin-right:400px;
   background-attachment: fixed;
   background-image: url(img/bg1.jpg);
   background-repeat: no-repeat;
   background-position: top left;
}

 

Also notice that you are missing a colon in the "margin-right" line. Replace the equals sign and wrap your site and you should be golden. Be sure to set the width of your site in the wrapper. I have 800px in there your site may be different.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...