...

View Full Version : Help?!?



gabriel515
04-04-2011, 09:46 PM
I want to make the div which happens to be the white area automatically adjust so that the image fits the div.


My HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" type="text/css" media="screen" href="style.css">
<title>TechBot</title>
</head>
<body>
<center><img class="banner" src="techbot_banner.png" alt="TechBot banner"/></center>
<div class="container">
<center><h1>Lorem Ipsum</h1></center>
<img class="img1" src="ads.png">
<p><span class="txt1"><a href="http://youtube.com">Lorem ipsum</a> dolor sit amet, consectetur adipiscing elit. Aenean sollicitudin egestas felis, et dapibus lectus dignissim vel. Pellentesque urna ligula, accumsan eu consequat vitae, condimentum ac mi. Sed at nisl mauris, quis interdum tellus. Nunc fermentum, nulla ut volutpat euismod, lacus leo elementum magna, ut aliquam dolor tellus in diam. Phasellus luctus arcu a sapien porta tincidunt. Quisque aliquet molestie dui sit amet dictum. Nunc scelerisque consequat faucibus. Duis sem nunc, semper vitae interdum sit amet, tincidunt vitae est. Praesent laoreet rhoncus arcu, in molestie massa tempus rutrum. Quisque et neque sit amet sem mollis pharetra in eget neque. Nulla euismod eleifend bibendum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Morbi ullamcorper tempor nunc id tempus. Nulla vitae felis diam, in vulputate tortor. In sagittis cursus erat, non volutpat sem tincidunt sed. Quisque consequat hendrerit lacinia. Nulla massa sem, varius vel vehicula at, suscipit et libero. Donec sodales lacinia volutpat. Donec sodales tincidunt justo, nec hendrerit nibh commodo ac.</span></p>
</div>
</body>
</html>

CSS:
body {
font-family: calibri;
background: rgb(244, 240, 236);
}
.txt1 {
text-align:justify;
color: #000000
}
.container {
width: 692px;
border: 1px solid black;
margin:0 auto;
margin-top: 20px;
background-color: #ffffff;
padding: 4px
}
a:link {
color: #00ffff;
text-decoration: none;
}
.banner {
border: 1px solid black;
}
.img1 {
float: right;
}


http://i51.tinypic.com/mt2qle.png

Aurora.Light
04-05-2011, 01:14 AM
wrap code in [code] [/-code] (no dash)

since your images are on your computer, I'm not sure if I can help you.

Excavator
04-05-2011, 01:29 AM
Hello gabriel515,
I just put some random sizes and a background color on that image for demonstration. If you clear the float then .container will expand to include it.
Try this -

.container {
width: 692px;
margin: 20px auto;
padding: 4px;
border: 1px solid black;
background: #fff;
overflow: auto;
}
.img1 {
height: 500px;
width: 100px;
float: right;
background: #f00;
}


See this explanation of how overflow: auto; clears your floats (http://www.quirksmode.org/css/clearing.html).

And, like Aurora.Light mentioned, when posting code in the forum, please use the code tags, &#91;code&#93;&#91;/code&#93; - available with the # button in the post edit window.
This will wrap your code in a scroll box which greatly helps the readability of your post.

bullant
04-05-2011, 02:16 AM
something like this?

This floats the image right and extends the div border to below the image if the image is higher than the text.


<!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>
<title></title>
<style type="text/css">
#content {
border: 1px solid red;
padding: 10px 10px 10px 10px;
overflow: hidden;
}
#content img {
float: right;
margin-left: 20px;
}
</style>
</head>
<body>
<div id="content">
<img src="pic1.jpg" alt="" />
Lorem ipsum dolor sit amet, tellus et. Molestie auctor nisl faucibus ut, lorem tortor mattis, fusce nullam enim fringilla vel.
Mauris vitae gravida dolor praesent. Id in nascetur aut odio, nam et. Pede libero bibendum sit felis pretium sodales, fusce
pharetra vestibulum bibendum morbi ultricies nullam, est nulla, id amet mollis.
</div>
</body>
</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum