By Chen Hui Jing / @hj_chen
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
...
@charset "utf-8";
/* all the styles for your web page */
https://youtu.be/5X9Dj7tBlkg
WOFF2 (Web Open Font Format 2) | |
WOFF (Web Open Font Format) | |
OTF (OpenType) | |
TTF (TrueType) | |
EOT (Embedded Open Type) | |
SVG (Scalable Vector Graphics) |
/* This text is in Lucida Grande */
.sans {
font-family: Lucida Grande,Lucida Sans Unicode,Lucida Sans,Geneva,Verdana,sans-serif;
}
/* A typical Chinese font stack, declare Latin fonts first */
.zh-hans {
font-family: Tahoma, Helvetica, Arial, "Microsoft Yahei", "微软雅黑", STXihei, "华文细黑", sans-serif;
}
@font-face {
font-family: 'Bellato';
src: url('Bellota-Regular.woff2') format('woff2'),
url('Bellota-Regular.woff') format('woff');
}
@font-face
rule@font-face {
font-family: <family-name>;
src: [ <url> [format(<string> #)]? | <font-face-name> ] #;
font-style: normal | italic | oblique ;
font-weight: normal | bold | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
font-stretch: normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded;
unicode-range: <urange> #;
font-variant: normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> || stylistic(<feature-value-name>) || historical-forms || styleset(<feature-value-name> #) || character-variant(<feature-value-name> #) || swash(<feature-value-name>) || ornaments(<feature-value-name>) || annotation(<feature-value-name>) || [ small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps ] || <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero || <east-asian-variant-values> || <east-asian-width-values> || ruby ];
font-feature-settings: normal | <feature-tag-value> #;
}
Slides for This world mixed and blended by Gao Wei.
@font-face {
font-family: 'Raleway';
src: url('fonts/raleway-regular.woff2') format('woff2'),
url('fonts/raleway-regular.woff') format('woff');
/* no range specified, defaults to entire range */
}
@font-face {
font-family: 'Raleway';
src: url('fonts/comfortaa_regular.woff2') format('woff2'),
url('fonts/comfortaa_regular.woff') format('woff');
unicode-range: U+0400–U+04FF; /* Unicode range for Cyrillic characters */
}
Dragons
to enable the ability for only the required part of the font be downloaded on any given page, and for subsequent requests for that font to dynamically ‘patch’ the original download with additional sets of glyphs as required on successive page views—even if they occur on separate sites
—Jason Pamental on Web Fonts & Typography News #11
Authors should language-tag their content accurately for the best typographic behaviour.
—CSS Text Module Level 3
font-kerning
|
font-variant-position
|
font-variant-position-ligatures
|
font-variant-numeric
|
font-variant-caps
|
font-variant-alternates
|
font-variant-east-asian
Allows control of glyph substitution and sizing in East Asian text
一个简体字可能对应多个繁体字,如简体字「发」,其相应的繁体字可能为「發」或「髮」;一个繁体汉字对应多个简体汉字的情况与前者相比数量极少但仍需注意,如繁体字「乾」可能对应简体字「干」或「乾」。繁简汉字的对应关系具体应由上下文决定。
唖 芦 溢 茨 鰯 嘘 欝 厩 噂
font-language-override
To control the use of language-specific glyph substitutions and positioning
<!-- Macedonian lang code -->
<body lang="mk">
<h4>Члeн 9</h4>
<p>Никoj чoвeк нeмa дa бидe пoдлoжeн нa прoизвoлнo aпсeњe, притвoр или прoгoнувaњe.</p>
</body>
body {
/* Serbian OpenType language tag */
font-language-override: "SRB";
}
Example lifted from CSS Fonts Module Level 4
text-transform
propertyIf I want [flowers], I’m going to send them to myself.
Süße Soßen-Klöße genießen maßgeblich gefräßige preußische Nutznießer.
Ουδέν κακόν αμιγές καλού.
ァィゥェ ォヵㇰヶ
text-emphasis
propertyWe use italics to emphasise words in English, 但是中文则是用着重号.
We use italics to emphasise words in English, 但是中文则是用着重号.
text-align
& text-justify
text-align-all
and text-align-last
propertiestext-align: start | end | left | right | center | justify | match-parent | justify-all
Values other than justify-all
or match-parent
are assigned to text-align-all
and reset text-align-last
to auto
.
Selects the justification method used when a line’s alignment is set to justify
text-justify: auto | none | inter-word | inter-character
定义了CSS如何支持各种不同国际化语言的书写模式,例如拉丁(Latin)语系及印度(Indic)语系采用从左到右的书写模式,希尔伯特语(Hebrew)或阿拉伯语(Arabic)采用从右到左的书写模式,一些混合了拉丁语和阿拉伯语的文字可能采用双向书写(bidirectional),而一些东亚文字则需要竖排(从上到下)的书写模式。
CSS Writing Modes Level 3 defines CSS features to support for various international writing modes, such as left-to-right (e.g. Latin or Indic), right-to-left (e.g. Hebrew or Arabic), bidirectional (e.g. mixed Latin and Arabic) and vertical (e.g. Asian scripts).
writing-mode
propertyhorizontal-tb | 从1987到现在 |
vertical-rl | 从1987到现在 |
vertical-lr | 从1987到现在 |
sideways-rl* | 从1987到现在 |
sideways-lr* | 从1987到现在 |
text-orientation
propertytext-combine-upright
property“Zwei Dinge sind unendlich, das Universum und die menschliche Dummheit, aber bei dem Universum bin ich mir noch nicht ganz sicher.”
Es liegt der heiße Sommer
Auf deinen Wängelein;
Es liegt der Winter, der kalte,
In deinem Herzchen klein.
Das wird sich bei dir ändern,
Du Vielgeliebte mein!
Der Winter wird auf den Wangen,
Der Sommer im Herzen sein.
Das Leben ist kein Ponyhof
If an element generates zero boxes, was it really there at all?
If an element generates zero boxes, was it really there at all?
line-break |
allows choosing various levels of “strictness” for line breaking restrictions |
word-break |
controls what types of letters are glommed together to form unbreakable “words”, causing CJK characters to behave like non-CJK text or vice versa |
hyphens |
controls whether automatic hyphenation is allowed to break words in scripts that hyphenate |
overflow-wrap |
allows the UA to take a break anywhere in otherwise-unbreakable strings that would otherwise overflow |
Line breaking by Florian Rivoal @ dotCSS