Reputation: 23591
I'm trying to place a border after the div tag , but the line showed around the text , not after below the image on left , how can i fix it ?
<html>
<head>
<title> This is an demo </title>
<style>
.left { float: left; }
.content {
clear: both;
border-color: #666666;
border-bottom: 3px solid;
}
</style>
</head>
<body>
<div class="content">
<img class="left" src="61add42atw1dnf1k4h4qzj.jpg" />
<p> This is a not so long paragraph</p>
</div>
</body>
</html>
How can i place the border a little lower ?
Thanks !
Upvotes: 1
Views: 2229
Reputation: 2748
I don't understand exactly what you want to achieve here but if you would like to have a div with an img
and p
below each other then you could just get rid of class="left"
in the img
and apply float: left
to the content
class.
<html>
<head>
<title> This is an demo </title>
<style>
.left { float: left; }
.content {
float: left; /* can get rid of this if you want your div to have the page witdh */
border-color: #666666;
border-bottom: 3px solid;
}
</style>
</head>
<body>
<div class="content">
<img src="image.jpg" />
<p> This is a not so long paragraph</p>
</div>
</body>
</html>
Upvotes: 0
Reputation: 129832
You need to clear
the current float
:
Either:
<br clear="left" /> <!-- or "right" or "all" -->
Or:
<div style="clear: left;"></div> <!-- or "right" or "both" -->
Upvotes: 2
Reputation: 659
In the .content div, replace the clear:both with overflow:hidden
.content {
overflow: hidden;
border-color: #666666;
border-bottom: 3px solid;
}
Upvotes: 1
Reputation: 10246
Use float:left;
for all:
Upvotes: 0