.Ecol {width: 365px; padding: 0 5px; float: left;}
.Espace {width: 110px; height: 290px; padding: 5px; float: right;}
.Epullout {width: 220px; height: 290px; padding: 5px; float: left; margin-left: -120px;}
.Epullout span {width: 220px; position: absolute;}
.Epullout del {font-size:0px; color:#aaa; position:absolute;}
The left column is simple. It puts the fixed height-and-width span into the text:
... metus eu leo. Nulla<span class="Espace"> </span> faucibus pretium ...
The right column is a little more complicated (Mr Frommelt's page describes exactly what's going on very succinctly), but essentially, it's another span that puts the image in the right place as defined by the .Epullout style:
... blandit, urna quam dignissim<span class="Epullout"><del> [Pullout:
</del><span><img src="http://www.ee-stuff.com/images/orangeX.jpg"
alt="" /> </span><del>] </del></span> sem, eu lobortis
nisl metus ...
If you're going to try it at home, pay attention to the part about counting the number of characters in a line, because it will save you a lot of tinkering. Having said that, the result is exactly what you would expect. But floating an image wasn't my problem; I needed to put a box with some text in there, and lots of searched didn't turn up anything that seemed as easy as placing the image had been.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>ericpete's test page</title>
<style type="text/css" media="screen">
/*<![CDATA[*/
* {margin: 0; padding: 0;}
body {margin: 0; font-family: sans-serif; font-size: 12px;}
#wrapper {width: 755px; margin: 0 auto; background-color: #aaaaaa;}
#header {margin: 0; background-color: #dddddd;}
#footer {clear: both; width: 755px; display:block;}
p {padding: .625em 0; line-height: 20px;}
h1 {font-size: 23px; line-height: 130%; padding-left: 10px;}
h2 {font-size: 13px; line-height: 130%; padding: 5px; text-align: center;}
.Ecol {width: 365px; padding: 0 5px; float: left;}
.Espace {width: 110px; height: 100px; padding: 5px; float: right;}
.Epullout {width: 220px; height: 100px; padding: 5px; float: left; margin-left: -120px;}
.Epullout span {width: 220px; position: absolute;}
.Epullout del {font-size:0px; color:#aaa; position:absolute;}
.callout {position: absolute; top: 150px; left: 690px; background-color: #FCC; height: 100px; width: 200px; margin: 10px; float: none; text-align: center;}
/*]]>*/
</style>
</head>
<body>
<div id="wrapper">
<div id="header">
<h1>Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...</h1>
</div>
<div class="Ecol" style="background-color: #FFFDEA;">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse convallis, urna vel mollis interdum, magna enim vulputate lectus, sed condimentum libero nisi nec justo. Sed ullamcorper, ante sit amet interdum blandit, urna quam dignissim sem, eu lobortis nisl metus eu leo. Nulla<span class="Espace"> </span> faucibus pretium enim, sed accumsan sapien elementum at. Mauris venenatis aliquet augue, sed venenatis leo rutrum sed. Nam consequat ornare scelerisque. Pellentesque turpis nibh, gravida quis aliquet at, euismod lacinia odio. Duis vitae sodales lectus. In gravida nunc non purus viverra vel volutpat libero semper. Sed aliquam metus ac lectus ullamcorper sed feugiat nibh adipiscing. Vivamus eu elementum nibh. Vestibulum massa tortor, vulputate vel accumsan faucibus, sodales posuere quam.</p>
<p>Suspendisse potenti. Integer pulvinar nibh eu neque aliquet sed egestas lectus lobortis. Curabitur aliquet dapibus lobortis. Vestibulum egestas, erat ut pretium ultrices, dolor diam sodales lorem, ut consequat libero tortor in diam.</p>
</div>
<div class="Ecol" style="background-color: #DAE5F0;" >
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse convallis, urna vel mollis interdum, magna enim vulputate lectus, sed condimentum libero nisi nec justo. Sed ullamcorper, ante sit amet interdum blandit, urna quam dignissim <span class="Epullout"><del> [Pullout: </del><span><img src="spacer.gif" width=220 height=120 border=1 alt="" /> </span><del>] </del></span> sem, eu lobortis nisl metus eu leo. Nulla faucibus pretium enim, sed accumsan sapien elementum at. Mauris venenatis aliquet augue, sed venenatis leo rutrum sed. Nam consequat ornare scelerisque. Pellentesque turpis nibh, gravida quis aliquet at, euismod lacinia odio. Duis vitae sodales lectus. In gravida nunc non purus viverra vel volutpat libero semper. Sed aliquam metus ac lectus ullamcorper sed feugiat nibh adipiscing. Vivamus eu elementum nibh. Vestibulum massa tortor, vulputate vel accumsan faucibus, sodales posuere quam.</p>
<p>Suspendisse potenti. Integer pulvinar nibh eu neque aliquet sed egestas lectus lobortis. Curabitur aliquet dapibus lobortis. Vestibulum egestas, erat ut pretium ultrices, dolor diam sodales lorem, ut consequat libero tortor in diam.</p>
<div class="callout">
<p>"There is no one who loves pain itself, who seeks after it<br />and wants to have it, simply because it is pain..."</p>
</div>
</div>
<div id="footer"><h2>Thanks to COBOLdinosaur and padas!!</h2>
</div>
</div>
</body>
</html>
p {padding: .6em 0; line-height: 1.25em;}
h1 {font-size: 1.5em; line-height: 130%; padding-left: 10px;}
h2 {font-size: .9em; line-height: 130%; padding: 5px; text-align: center;}
Similarly, the height of the two blank <span>s -- Rspace and Lspace -- that are inserted into the main columns, are set as a multiple of the text size, expressed in
ems.
.Lspace {width: 110px; height: 6em; padding: 5px; float: right;}
.Rspace {width: 110px; height: 6em; padding: 5px; float: left;}
Finally, while the callout <div> is still positioned absolutely, but its position is set in ems as well.
.callout {position: absolute; top: 11em; width: 224px; left: 50%; margin-left: -120px; background-color: #FCC; height: 6em; text-align: center; border: 1px solid black; padding: 2px;}
<!-- callout size = number of lines down as a count expressed in em (each line is 1.85) + 2.4 -->
Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.
Comments (6)
Commented:
Author
Commented:Thank YOU.
ep
Commented:
Cd&
Commented:
Author
Commented:This is true. But I also share.
I tried to vote twice but they are pretty good about not letting that happen.
They wouldn't let me vote either... go figure.
View More