tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

font-size.rst (2879B)


      1 ==========
      2 font-size
      3 ==========
      4 
      5 The ``use-design-tokens`` rule checks that CSS ``font-size`` declarations use
      6 design token variables instead of hardcoded values. This ensures consistent
      7 font-size usage across the application and makes it easier to maintain design
      8 system consistency.
      9 
     10 Examples of incorrect code for this rule:
     11 -----------------------------------------
     12 
     13 .. code-block:: css
     14 
     15  .custom-text {
     16    font-size: 12px;
     17  }
     18 
     19 .. code-block:: css
     20 
     21  .heading {
     22    font-size: 1rem;
     23  }
     24 
     25 .. code-block:: css
     26 
     27  .small-text {
     28    font-size: 0.867rem;
     29  }
     30 
     31 .. code-block:: css
     32 
     33  .large-text {
     34    font-size: 1.2em;
     35  }
     36 
     37 .. code-block:: css
     38 
     39  .percentage-text {
     40    font-size: 100%;
     41  }
     42 
     43 .. code-block:: css
     44 
     45  .point-text {
     46    font-size: 16pt;
     47  }
     48 
     49 Examples of correct token usage for this rule:
     50 ----------------------------------------------
     51 
     52 .. code-block:: css
     53 
     54  .custom-text {
     55    font-size: var(--font-size-root);
     56  }
     57 
     58 .. code-block:: css
     59 
     60  .small-text {
     61    font-size: var(--font-size-small);
     62  }
     63 
     64 .. code-block:: css
     65 
     66  .large-text {
     67    font-size: var(--font-size-large);
     68  }
     69 
     70 .. code-block:: css
     71 
     72  .xlarge-text {
     73    font-size: var(--font-size-xlarge);
     74  }
     75 
     76 .. code-block:: css
     77 
     78  .xxlarge-text {
     79    font-size: var(--font-size-xxlarge);
     80  }
     81 
     82 .. code-block:: css
     83 
     84  .xxxlarge-text {
     85    font-size: var(--font-size-xxxlarge);
     86  }
     87 
     88 .. code-block:: css
     89 
     90  .heading-medium {
     91    font-size: var(--heading-font-size-medium);
     92  }
     93 
     94 .. code-block:: css
     95 
     96  .heading-large {
     97    font-size: var(--heading-font-size-large);
     98  }
     99 
    100 .. code-block:: css
    101 
    102  .heading-xlarge {
    103    font-size: var(--heading-font-size-xlarge);
    104  }
    105 
    106 .. code-block:: css
    107 
    108  /* Local CSS variables that reference valid font-size tokens are allowed */
    109  :root {
    110    --custom-font-size: var(--font-size-small);
    111  }
    112 
    113  .custom-text {
    114    font-size: var(--custom-font-size);
    115  }
    116 
    117 .. code-block:: css
    118 
    119  .custom-text {
    120    font-size: var(--custom-font-size, var(--font-size-small));
    121  }
    122 
    123 The rule also allows these non-token values:
    124 
    125 .. code-block:: css
    126 
    127  .xxsmall-text {
    128    font-size: xx-small;
    129  }
    130 
    131 .. code-block:: css
    132 
    133  .xsmall-text {
    134    font-size: x-small;
    135  }
    136 
    137 .. code-block:: css
    138 
    139  .small-text {
    140    font-size: small;
    141  }
    142 
    143 .. code-block:: css
    144 
    145  .medium-text {
    146    font-size: medium;
    147  }
    148 
    149 .. code-block:: css
    150 
    151  .large-text {
    152    font-size: large;
    153  }
    154 
    155 .. code-block:: css
    156 
    157  .xlarge-text {
    158    font-size: x-large;
    159  }
    160 
    161 .. code-block:: css
    162 
    163  .xxlarge-text {
    164    font-size: xx-large;
    165  }
    166 
    167 .. code-block:: css
    168 
    169  .xxxlarge-text {
    170    font-size: xxx-large;
    171  }
    172 
    173 .. code-block:: css
    174 
    175  .smaller-text {
    176    font-size: smaller;
    177  }
    178 
    179 .. code-block:: css
    180 
    181  .larger-text {
    182    font-size: larger;
    183  }
    184 
    185 .. code-block:: css
    186 
    187  .inherited-text {
    188    font-size: inherit;
    189  }
    190 
    191 .. code-block:: css
    192 
    193  .initial-text {
    194    font-size: initial;
    195  }
    196 
    197 .. code-block:: css
    198 
    199  .unset-text {
    200    font-size: unset;
    201  }