cssgrids-align.mustache revision d1c2218ce9ffb1b9bfcc6dd9deb399136a4031b6
0N/A <a href="cssgrids-align-example.html" target="_blank" class="button">
0N/A<p>Sometimes is it desirable for units to be horizontally centered when taking up less than 100% of the width of the containing grid. Rather than setting the alignment for all grids, we will add an <code>ID</code> to target the specific content being aligned. For this example, the <code>ID</code> "demo" is used, but this should be tailored to your specific content.</p>
0N/A<p>Using the CSS <code>text-align</code> property on the containing grid tells the units inside of a grid how to align. We will also reset the centering so that subsequent content is left-aligned.</p>
0N/A<p>Vertical alignment tells mixed height units how they should align relative to one another, so at least 2 units are required.</p>
0N/A <a href="#"><img width="80" height="60" src="museum.jpg">
<a href="#"><img height="80" width="60" src="museum.jpg">
<a href="#"><img height="80" width="60" src="museum.jpg">
<p>Each unit needs to be told how it should align using the CSS <code>vertical-align</code> property. In this case, we want them all to be bottom aligned.</p>
<p>Its possible to vertically center a single unit, although a second stub unit is required for it to align with.</p>
<p>Setting the height of the stub to the desired height of the container allows the content to align with the middle of the stub, vertically centered in the container. Setting the <code>vertical-align</code> CSS property for both units tells them how to behave with repsect to the other units.</p>