diff options
Diffstat (limited to 'files/uk/web/css/font-weight/index.html')
-rw-r--r-- | files/uk/web/css/font-weight/index.html | 271 |
1 files changed, 0 insertions, 271 deletions
diff --git a/files/uk/web/css/font-weight/index.html b/files/uk/web/css/font-weight/index.html deleted file mode 100644 index b65007bb13..0000000000 --- a/files/uk/web/css/font-weight/index.html +++ /dev/null @@ -1,271 +0,0 @@ ---- -title: font-weight -slug: Web/CSS/font-weight -translation_of: Web/CSS/font-weight ---- -<div>{{CSSRef}}</div> - -<p>The <strong><code>font-weight</code></strong> <a href="/uk/docs/CSS" title="CSS">CSS</a> property specifies the weight (or boldness) of the font. The font weights available to you will depend on the {{cssxref("font-family")}} you are using. Some fonts are only available in <code>normal</code> and <code>bold</code>.</p> - -<div>{{EmbedInteractiveExample("pages/css/font-weight.html")}}</div> - - - -<h2 id="Syntax">Syntax</h2> - -<pre class="brush:css no-line-numbers">/* Keyword values */ -font-weight: normal; -font-weight: bold; - -/* Keyword values relative to the parent */ -font-weight: lighter; -font-weight: bolder; - -/* Numeric keyword values */ -font-weight: 100; -font-weight: 200; -font-weight: 300; -font-weight: 400; -font-weight: 500; -font-weight: 600; -font-weight: 700; -font-weight: 800; -font-weight: 900; - -/* Global values */ -font-weight: inherit; -font-weight: initial; -font-weight: unset; -</pre> - -<p>The <code>font-weight</code> property is specified using a single keyword value from the list below.</p> - -<h3 id="Values">Values</h3> - -<dl> - <dt><code>normal</code></dt> - <dd>Normal font weight. Same as <code>400</code>.</dd> - <dt><code>bold</code></dt> - <dd>Bold font weight. Same as <code>700</code>.</dd> - <dt><code>lighter</code></dt> - <dd>One font weight lighter than the parent element (among the available weights of the font).</dd> - <dt><code>bolder</code></dt> - <dd>One font weight heavier than the parent element (among the available weights of the font).</dd> - <dt><code>100</code>, <code>200</code>, <code>300</code>, <code>400</code>, <code>500</code>, <code>600</code>, <code>700</code>, <code>800</code>, <code>900</code></dt> - <dd>Numeric font weights for fonts that provide more than just <code>normal</code> and <code>bold</code>.</dd> -</dl> - -<h3 id="Fallback_weights">Fallback weights</h3> - -<p>If the exact weight given is unavailable, then the following heuristic is used to determine the weight actually rendered:</p> - -<ul> - <li>If a weight greater than <code>500</code> is given, the closest available heavier weight is used (or, if there is none, the closest available lighter weight).</li> - <li>If a weight less than <code>400</code> is given, the closest available lighter weight is used (or, if there is none, the closest available heavier weight).</li> - <li>If a weight of exactly <code>400</code> is given, then <code>500</code> is used. If <code>500</code> is not available, then the heuristic for font weights less than 400 is used.</li> - <li>If a weight of exactly <code>500</code> is given, then <code>400</code> is used. If <code>400</code> is not available, then the heuristic for font weights less than 400 is used.</li> -</ul> - -<p>This means that for fonts that provide only <code style="font-style: normal;">normal</code> and <code style="font-style: normal;">bold</code>, <code style="font-style: normal;">100</code>-<code>500</code> are <code>normal</code>, and <code style="font-style: normal;">600</code>-<code style="font-style: normal;">900</code> are <code>bold</code>.</p> - -<h3 id="Meaning_of_relative_weights">Meaning of relative weights</h3> - -<p>When <code>lighter</code> or <code>bolder</code> is specified, the following chart shows how the absolute font weight of the element is determined:</p> - -<table class="standard-table"> - <thead> - <tr> - <th>Inherited value</th> - <th><code>bolder</code></th> - <th><code>lighter</code></th> - </tr> - </thead> - <tbody> - <tr> - <th>100</th> - <td>400</td> - <td>100</td> - </tr> - <tr> - <th>200</th> - <td>400</td> - <td>100</td> - </tr> - <tr> - <th>300</th> - <td>400</td> - <td>100</td> - </tr> - <tr> - <th>400</th> - <td>700</td> - <td>100</td> - </tr> - <tr> - <th>500</th> - <td>700</td> - <td>100</td> - </tr> - <tr> - <th>600</th> - <td>900</td> - <td>400</td> - </tr> - <tr> - <th>700</th> - <td>900</td> - <td>400</td> - </tr> - <tr> - <th>800</th> - <td>900</td> - <td>700</td> - </tr> - <tr> - <th>900</th> - <td>900</td> - <td>700</td> - </tr> - </tbody> -</table> - -<h3 id="Common_weight_name_mapping">Common weight name mapping</h3> - -<p>The numerical values (<code>100</code> to <code>900</code>) roughly correspond to the following common weight names:</p> - -<table class="standard-table"> - <thead> - <tr> - <th scope="col">Value</th> - <th scope="col">Common weight name</th> - </tr> - </thead> - <tbody> - <tr> - <td>100</td> - <td>Thin (Hairline)</td> - </tr> - <tr> - <td>200</td> - <td>Extra Light (Ultra Light)</td> - </tr> - <tr> - <td>300</td> - <td>Light</td> - </tr> - <tr> - <td>400</td> - <td>Normal (Regular)</td> - </tr> - <tr> - <td>500</td> - <td>Medium</td> - </tr> - <tr> - <td>600</td> - <td>Semi Bold (Demi Bold)</td> - </tr> - <tr> - <td>700</td> - <td>Bold</td> - </tr> - <tr> - <td>800</td> - <td>Extra Bold (Ultra Bold)</td> - </tr> - <tr> - <td>900</td> - <td>Black (Heavy)</td> - </tr> - </tbody> -</table> - -<h3 id="Interpolation">Interpolation</h3> - -<p>A <code>font-weight</code> value is interpolated via discrete steps (multiples of 100). The interpolation happens in real number space and is converted to an integer by rounding to the nearest multiple of 100, with values halfway between multiples of 100 rounded towards positive infinity.</p> - -<h3 id="Formal_syntax">Formal syntax</h3> - -{{csssyntax}} - -<h2 id="Examples" name="Examples">Examples</h2> - -<h3 id="HTML">HTML</h3> - -<pre class="brush: html"><p> - Alice was beginning to get very tired of sitting by her sister on the - bank, and of having nothing to do: once or twice she had peeped into the - book her sister was reading, but it had no pictures or conversations in - it, 'and what is the use of a book,' thought Alice 'without pictures or - conversations?' -</p> - -<div>I'm heavy<br/> - <span>I'm lighter</span> -</div> -</pre> - -<h3 id="CSS">CSS</h3> - -<pre class="brush:css">/* Set paragraph text to be bold. */ -p { - font-weight: bold; -} - -/* Set div text to two steps heavier than - normal but less than a standard bold. */ -div { - font-weight: 600; -} - -/* Set span text to be one step lighter - than its parent. */ -span { - font-weight: lighter; -}</pre> - -<h3 id="Result">Result</h3> - -<p>{{EmbedLiveSample("Examples","400","300")}}</p> - -<h2 id="Specifications">Specifications</h2> - -<table class="standard-table"> - <thead> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - </thead> - <tbody> - <tr> - <td>{{SpecName('CSS3 Fonts', '#font-weight-prop', 'font-weight')}}</td> - <td>{{Spec2('CSS3 Fonts')}}</td> - <td>No change.</td> - </tr> - <tr> - <td>{{SpecName('CSS3 Transitions', '#animatable-css', 'font-weight')}}</td> - <td>{{Spec2('CSS3 Transitions')}}</td> - <td>Defines <code>font-weight</code> as animatable.</td> - </tr> - <tr> - <td>{{SpecName('CSS2.1', 'fonts.html#propdef-font-weight', 'font-weight')}}</td> - <td>{{Spec2('CSS2.1')}}</td> - <td>No change.</td> - </tr> - <tr> - <td>{{SpecName('CSS1', '#font-weight', 'font-weight')}}</td> - <td>{{Spec2('CSS1')}}</td> - <td>Initial definition.</td> - </tr> - </tbody> -</table> - -<p>{{cssinfo}}</p> - -<h2 id="Browser_compatibility">Browser compatibility</h2> - - - -<p>{{Compat("css.properties.font-weight")}}</p> |