...

View Full Version : align text alongside two div elements?



stfc_boy
01-11-2008, 05:40 PM
Hi Guys,

Wondering oif someone could help with my layout please

In my layout I have some text that I call out of a database. I then want the text to align alongside two div elements, but I can't get it to work. I want it like this:

http://www.slougheaz.org/example.jpg



<style>
.pic_float_right {
float:right;
border:solid 1px silver;
padding:5px;
margin-left: 5px;
margin-right:10px;
margin-top: 10px;
margin-bottom: 10px;
}

.video_float_right {
background-color: #F5F5F5;
width:200px;
display:inline;
float:right;
border:solid 1px silver;
padding:5px;
margin-left: 5px;
margin-right:10px;
margin-top: 10px;
margin-bottom: 10px;
}
</style>

[/html]

<div class="video_float_right"><img src="images/camera.png" />View Video</div>
<div class="pic_float_right"><img src="images/person.jpg" /></div>
<p><?php echo nl2br($body_text); ?></p>


Thanks

Chris

Excavator
01-11-2008, 06:18 PM
Hello stfc_boy,
You just need to add clear:right; so the floats won't float next to each other. Like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<meta name="" content="authored by http://nopeople.com/Design" />
<style type="text/css">
html, body {
background: #CCCCCC;
}
* {
margin: 0;
padding: 0;
border: none;
}
#container {
width: 760px;
margin: 0 auto;
overflow: auto;
background: #66CCCC;
}
.pic_float_right {
float:right;
clear: right;
width:200px;
height: 200px;
border:solid 1px silver;
background: #00FF00;
padding:5px;
margin: 10px 10px 10px 5px;
}
.video_float_right {
background-color: #F5F5F5;
width:200px;
height: 200px;
float:right;
border:solid 1px silver;
padding:5px;
margin: 10px 10px 10px 5px;
}
</style>
</head>
<body>
<div id="container">
<div class="video_float_right">
<a href=""><img src="images/camera.png" />View Video</a>
</div>
<div class="pic_float_right">
<img src="images/person.jpg" />
</div>
<p>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna
aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no
sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo
duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
</p>
<p>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna
aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no
sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo
duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
</p>
<!--end container--></div>
</body>
</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum