Reputation: 171
I'm having problem aligning an image with text.
#content img{
border: 2px solid black;
vertical-align: middle;
}
<div id="content">
<h1><b>Company News 1</b></h1>
<img src="http://www.placehold.it/120x120">
<span style="">
A lot of text...
</span>
</div>
The result is this:
What am I doing wrong?
Upvotes: 0
Views: 111
Reputation: 3059
Simple and easy. Enjoy
#content img {
border: 2px solid black;
vertical-align: middle;
float:left;
margin:0 20px 10px 0;
}
Upvotes: 0
Reputation: 8981
Like this
#content img {
border: 2px solid black;
vertical-align: middle;
float: left;
margin: 0 10px;
}
Upvotes: 0
Reputation: 6938
Use float:left
property
#content img{
border: 2px solid black;
vertical-align: middle;
width:120px;
height:120px;
float:left;
}
Fiddle : http://jsfiddle.net/kJHK7/1/
Upvotes: 0
Reputation: 4638
check the js fiddle
#content img
{
border: 2px solid black;
vertical-align: middle;
float:left;
}
Upvotes: 0
Reputation: 3550
I'm assuming you want the text to wrap the image? Try the following instead -
#content img {
border: 2px solid black;
float: left;
}
Upvotes: 0
Reputation: 24276
#content img{
border: 2px solid black;
float:left;
margin-right:5px;
}
Upvotes: 2