Make WordPress Core

Changeset 21326


Ignore:
Timestamp:
07/25/2012 04:46:21 PM (12 years ago)
Author:
lancewillett
Message:

Twenty Twelve: add explanatory notes to top of style.css for the use of rem and pixel units for font-size and line-height values, props drewstrojny. See #21379.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentytwelve/style.css

    r21325 r21326  
    1414Use it to make something cool, have fun, and share what you've learned with others.
    1515*/
     16
     17/* =Notes
     18--------------------------------------------------------------
     19This stylesheet uses rem values with a pixel fallback. The rem
     20values (and line heights) are calculated using two variables:
     21
     22$rembase:      14;
     23$line-height:  24;
     24
     25---------- Examples
     26
     27* Use a pixel value with a rem fallback for font-size, padding, margins, etc.
     28    padding: 5px 0;
     29    padding: 0.357142857rem 0; (5 / $rembase)
     30
     31* Set a font-size and then set a line-height based on the font-size
     32    font-size: 16px
     33    font-size: 1.142857143rem; (16 / $rembase)
     34    line-height: 1.846153846; ($line-height / 16)
     35
     36---------- Vertical spacing
     37
     38Vertical spacing between most elements should use 24px or 48px
     39to maintain vertical rhythm:
     40
     41.my-new-div {
     42    margin: 24px 0;
     43    margin: 1.714285714rem 0; ( 24 / $rembase )
     44}
     45
     46---------- Further reading
     47
     48http://snook.ca/archives/html_and_css/font-size-with-rem
     49http://blog.typekit.com/2011/11/09/type-study-sizing-the-legible-letter/
     50
    1651
    1752/* =Reset
Note: See TracChangeset for help on using the changeset viewer.