I am seeking advice on the best way to format the layout below, ensuring everything is properly aligned and neatly spaced:
Below is the HTML code:
<div class"wrapper">
<img alt="Image 1" src="images/image1.png" />
<div class="description">
<h1>Heading 1</h1>
<p>Paragraph 1</h1>
</div>
</div>
While attempting to align the h1 with the top of the image, I used the code snippet below which didn't seem to work as expected:
img, div.description {
float: left;
}
div.description { margin-left: 10px; vertical-align: top; }
h1 { background: blue; }
p { background: red; }
What if we wanted the right side content to be vertically centered instead of top-aligned as shown below?
Here is the JSFiddle link:
http://jsfiddle.net/johngoche99/ZPKZj/1/
To prevent text from dropping below when resizing the browser, it is necessary to specify the width of the wrapper element, such as 700px. Doing so will resolve the issue.
Thank you.