<h2><img src="img.jpg" height="75px"> some text</h2>
I would like to position my image right next to a block of text but have it padded down slightly, how can I achieve this? I have tried style: padding 10px;
without success inside the image tag.
I think you are looking for something like this. http://jsfiddle.net/3HZr7/
<h2>
<img src="img.jpg" height="75px">
<span>some text</span>
</h2>
h2{
overflow: auto;
}
h2 span{
float: left;
margin-top: 10px;
margin-left: 10px;
}
h2 img{
float: left;
}
You misunderstand the CSS box model.
Padding is for the space inside of the box, margin on the other hand, is responsible for the space outside the box, the space the box has from its container.
So your possible solutions are simple:
padding
on the parent element.margin
on the image element.Example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With