Skip to content

Commit f1b042b

Browse files
Create Typography.md
1 parent 6630119 commit f1b042b

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

docs/CSS/css-basics/Typography.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Typography
2+
3+
Typography in CSS is an essential aspect of web design, as it greatly influences the readability, aesthetics, and overall user experience of a website. Here are the key concepts and properties related to typography in CSS:
4+
5+
**1. Font Family**
6+
7+
The `font-family` property specifies the typeface for the text. It can include a specific font name and one or more generic font families.
8+
9+
```css
10+
body {
11+
font-family: 'Arial', sans-serif;
12+
}
13+
```
14+
15+
**2. Font Size**
16+
17+
The font-size property controls the size of the text. It can be set in various units like pixels (`px`), em units (`em`), rem units (`rem`), percentages (`%`), and more.
18+
19+
```css
20+
p {
21+
font-size: 16px;
22+
}
23+
24+
h1 {
25+
font-size: 2em; /* 2 times the current font size */
26+
}
27+
```
28+
You can check the relation between units
29+
30+
<img src="https://tse4.mm.bing.net/th?id=OIP.x3eQ0WknsCLHiRLl5jGYowHaEr&pid=Api&P=0&h=180" alt="CSS" height= "300" width="500"/>
31+
32+
**3. Font Weight**
33+
34+
The `font-weight` property defines the thickness of the characters. Common values include `normal`, `bold`, `bolder`, `lighter`, or numerical values ranging from 100 to 900.
35+
36+
```css
37+
strong {
38+
font-weight: bold;
39+
}
40+
41+
p.light {
42+
font-weight: 300;
43+
}
44+
```
45+
46+
**4. Font Style**
47+
48+
The `font-style` property allows you to italicize the text.
49+
50+
```css
51+
em {
52+
font-style: italic;
53+
}
54+
55+
p.oblique {
56+
font-style: oblique;
57+
}
58+
```
59+
60+
**5. Font Variant**
61+
62+
The `font-variant` property is used for small-caps and other typographic features.
63+
64+
```css
65+
p {
66+
font-variant: small-caps;
67+
}
68+
```

0 commit comments

Comments
 (0)