I'm implementing a simple two columns layout, where elements on the left column floats to the right and viceversa.
These are the class definitions:
.row {
display: table;
}
.column {
float: left;
width: 50%;
}
.column > h3, p, img {
width: 50%;
height: auto;
margin: 2%;
}
.left { text-align: right; }
.right { text-align: left; }
.left > h3, p { float: right; text-align: right; }
.right > h3, p { float: left; text-align: left; }
While this is the HTML structure:
<div class="row">
<div class="column left">
<h3>My title</h3>
<p>My paragraph.</p>
</div>
<div class="column right">
<img src="images/my-image.jpg">
</div>
</div>
The strange thing here is that while the h3 element floats to the right as expected, the p element stays on the left. If I inspect it, I see that both the .right > h3, p and the .left > h3, p styles are being applied, but I don't see why the first one since it's a .left element's child, not .right.
What am I missing here?