As a newcomer to css, I am struggling with adding margin-left to my paragraph and <h2>
, and it's not taking effect.
I have a 700px div and I want to add a 10px margin-left to both <p>
and <h2>
in relation to the image.
Despite my efforts, it seems that the margin is not being applied correctly. Can someone provide some guidance?
This is what I've attempted:
My jsfiddle showcasing the issue:
Here is a snippet of my html:
<div id="example">
<img src="images/image3.jpg" width="226" height="129" />
<h2>Example</h2>
<p>text here text here text here text here text here text here text here text here text here text here </p>
</div>
And here is a snippet of my css:
#example {width:690px; height:auto; font-size:16px; margin:15px 0 0 0;}
#example img{float:left;}
#example h2{float:right;margin-left:10px; font-size:16px; color:#444;}
#example p{ text-align:justify; margin-left:10px; }