Dealing with margins has been quite a challenge for me lately. In the beginning of my markup, I have a div that is floated to the right.
.grey{
float:right;
width:200px;
}
My goal is to add some styles (background and margin) to the first paragraph that comes after this floated div.
.blue{
background-color: blue;
margin: 10px;
overflow:hidden;
}
Now, to prevent the background from extending under the floated div, I need to set "overflow: hidden" for the paragraph. However, I am facing two peculiar issues.
The margin doesn't seem to affect the side of the paragraph that touches the float;
The margin appears to affect the floated element next to it..
You can check out the issue in this fiddle: http://jsfiddle.net/whiteatom/Nkfzg/6/
Could someone help me figure out how to create margin space between the "Blue" element and the floated one? Also, any tips on removing these mysterious margins around my floated element would be greatly appreciated.
Thank you,
whiteatom