Forum Moderators: not2easy

Message Too Old, No Replies

positioning a floating .jpg

inside a div

         

stef24

1:18 pm on Oct 20, 2004 (gmt 0)

10+ Year Member



By looking at the code below could anyone tell me how to make slice.jpg sit in the bottom left hand corner of my content div?

right now i change the margin-top value every time i add a paragraph of text to the txtblock1 div.

"margin-top: 100%" works in IE but the it sits about 50px too high in Moz and Opera.

many thanks for a xbrowser solution that validates.

<body>
<div id="content">

<img class="slice" style="margin-top: 510px;" src="images/jpg_gif/slice.jpg" height="200" width="191" alt="picture"/>

<div id="txtblock1">
<p>Lorem Ipsum ...</p>
</div>

<div id="footer">
<p>Lorem Ipsum ...</p>
</div>

</div>

</body>
</html>

body {
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
font-family: Trebuchet MS, verdana, arial, helvetica, sans-serif;
background-color: #f5ffd6;
text-align: center;
/* part 1 of 2 centering hack */
}
#content {
margin-top: 20px;
margin-bottom: 0px;
margin-right: auto;
margin-left: auto;
padding-right: 0px;
/* opera does not like 'margin:20px auto' */
border: 5px solid #e6ff99;
background: #fff;
/* part 2 of 2 centering hack */
width: 625px; /* ie5win fudge begins */
voice-family: "\"}\"";
voice-family:inherit;
width: 655px;

}
html>body #content {
height: 50%;
width: 625px; /* ie5win fudge ends */
}

.slice {
float: left;
padding-right: 20px;
margin-top: 60px;

}

createErrorMsg

3:17 pm on Oct 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



#content{
position:relative;
margin-bottom: EQUAL TO HEIGHT OF IMAGE;
}

.slice {
position:absolute;
bottom:0;
left:0;
}

Lance

4:04 pm on Oct 20, 2004 (gmt 0)

10+ Year Member



How about:

#content:{
background: url(images/jpg_gif/slice.jpg) no-repeat left bottom;
}

?

stef25

7:54 pm on Oct 23, 2004 (gmt 0)

10+ Year Member



createErrorMsg, thanks that worked. have not yet tried the second solution

Stef