User Tools

Site Tools


css
no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


css [2017/03/15 23:45] (current) – created shawn
Line 1: Line 1:
 +====== Center a block element ======
  
 +''text-align'' only centers the text inside the block. To center an entire
 +block element, we must make it smaller than the parent (otherwise,
 +what's the point?) then tell the browser to adjust the left and right
 +margins accordingly.
 +
 +<code css>
 +div.center {
 + width: 80%;
 + margin-left: auto;
 + margin-right: auto;
 +/* -or-
 + margin: 0 auto;
 +*/
 +}
 +</code>
css.txt · Last modified: 2017/03/15 23:45 by shawn

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki