nomaeswonk
06-22-2010, 05:10 AM
Hello,
I am trying to assign a background image to a div that stays in the bottom-right corner of the div whether you scroll down or resize the browser window (with browser resize priority).
The only problem I run into is when the browser window is wider than the width of the div. The background image, follows the constraints of the browser window and NOT the div I assigned it to. As a result, the background-image doesn't stay within the constraints of the div.
CSS
html{
height:100%;
}
body{
margin:0;
padding:0;
height:100%;
}
.wrapper{
width:600px;
margin: 0 auto;
border:1px dashed #666;
background-image:url(image.jpg);
background-repeat:no-repeat;
background-position:bottom right;
background-attachment:fixed;
}
h1{
font-family:Georgia, serif;
font-size:4em;
color:#222;
}
p{
width:36em;
font-family:Georgia, serif;
font-size:.75em;
line-height:1.5em;
color:#222;
}
HTML
<body>
<div class="wrapper">
<h1>Header</h1>
<p>Paragraph 1</p>
<p>Paragraph 2</p>
<p>Paragraph 3</p>
<p>Paragraph 4</p>
</div>
</body>
Anyone have any suggestions?
I am trying to assign a background image to a div that stays in the bottom-right corner of the div whether you scroll down or resize the browser window (with browser resize priority).
The only problem I run into is when the browser window is wider than the width of the div. The background image, follows the constraints of the browser window and NOT the div I assigned it to. As a result, the background-image doesn't stay within the constraints of the div.
CSS
html{
height:100%;
}
body{
margin:0;
padding:0;
height:100%;
}
.wrapper{
width:600px;
margin: 0 auto;
border:1px dashed #666;
background-image:url(image.jpg);
background-repeat:no-repeat;
background-position:bottom right;
background-attachment:fixed;
}
h1{
font-family:Georgia, serif;
font-size:4em;
color:#222;
}
p{
width:36em;
font-family:Georgia, serif;
font-size:.75em;
line-height:1.5em;
color:#222;
}
HTML
<body>
<div class="wrapper">
<h1>Header</h1>
<p>Paragraph 1</p>
<p>Paragraph 2</p>
<p>Paragraph 3</p>
<p>Paragraph 4</p>
</div>
</body>
Anyone have any suggestions?