To achieve the desired layout, follow these steps:
Start with the following HTML structure:
<div class="outer_box">
<img src="http://placehold.it/100x50">
<div class="bottom_box">
<h1>$25 OFF</h1>
<p>$25 off your first cleaning!</p>
</div>
</div>
Apply the CSS styles below:
.outer_box {
border: solid #6ac5ac 3px;
display: inline-block;
width: 250px;
height: 200px;
margin: 0.5em;
}
.bottom_box {
clear: both;
border: 1px dotted gray; /* for demonstration purposes */
}
img {
float: right;
padding: 3px;
margin: 0 0 1em 1em;
}
p {
color: blue;
margin-left: 50px;
}
h1 {
color: red;
margin-left: 50px;
}
If you have a floated image, make sure to clear the .bottom-box
to avoid overlap.
You can add white space using the margin-left
property on child elements.
Check out an example here: http://jsfiddle.net/audetwebdesign/3SjRG/
If you want to center the content of p
and h1
, use text-align: center
. The alignment depends on whether you prefer ragged left or ragged right text block;