I have an image that I want to align on one side of the div. I also have paragraphs that should go along with this image. However, they do not have enough text content to reach the maximum level of the image. The content under the paragraphs I need should be below the image.
Using float:left for an image does not work, because the container div for an image with the necessary paragraphs does not respond to the height of the floating elements.
Using position:relative; left:0px position:relative; left:0px for the image also does not work. With this I fiddled with the display paragraphs, but they always go under the image, not next.
h3 {text-align:center} img {position:relative;left:0px} p {display:inline-block;}
<body> <div> <div> <h3>Header Here</h3> <img src="http://www.devtano.com/software/eco/images/console.png"/> <p>This paragraph should be next to the image.</p> <p>This paragraph should also be next to the image.</p> </div> <div> <h3>Another Header</h3> <p>Everything from the above header and down should appear below the image.</p> </div> </div> </body>
Here is the fiddle .
EDIT
After reviewing these answers, I found a more elegant solution:
h3 {clear:both; text-align:center} img {float:left; margin-right:10px}
This implies a clear correction and makes it more easily applicable.
bcdan source share