Skip to content

Typograpghy #371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 3, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions docs/CSS/css-basics/Typography.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Typography

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:

**1. Font Family**

The `font-family` property specifies the typeface for the text. It can include a specific font name and one or more generic font families.

```css
body {
font-family: 'Arial', sans-serif;
}
```

**2. Font Size**

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.

```css
p {
font-size: 16px;
}

h1 {
font-size: 2em; /* 2 times the current font size */
}
```
You can check the relation between units

<img src="https://tse4.mm.bing.net/th?id=OIP.x3eQ0WknsCLHiRLl5jGYowHaEr&pid=Api&P=0&h=180" alt="CSS" height= "300" width="500"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Table and remove img

For Example Table in Markdown

Here is an example of a table in Markdown:

| Header 1 | Header 2 | Header 3 |
|----------|----------|----------|
| Row 1, Col 1 | Row 1, Col 2 | Row 1, Col 3 |
| Row 2, Col 1 | Row 2, Col 2 | Row 2, Col 3 |
| Row 3, Col 1 | Row 3, Col 2 | Row 3, Col 3 |

You can add alignment to the columns as well:

| Left-Aligned | Center-Aligned | Right-Aligned |
|:-------------|:--------------:|--------------:|
| This         | This           | This          |
| column       | column         | column        |
| will         | will           | will          |
| be           | be             | be            |
| left-aligned | center-aligned | right-aligned |


**3. Font Weight**

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.

```css
strong {
font-weight: bold;
}

p.light {
font-weight: 300;
}
```

**4. Font Style**

The `font-style` property allows you to italicize the text.

```css
em {
font-style: italic;
}

p.oblique {
font-style: oblique;
}
```

**5. Font Variant**

The `font-variant` property is used for small-caps and other typographic features.

```css
p {
font-variant: small-caps;
}
```

**6. Text Transform**

The `text-transform` property changes the case of the text.

```css
h1 {
text-transform: uppercase;
}

p {
text-transform: capitalize;
}
```

**7. Text Alignment**

The `text-align` property sets the horizontal alignment of the text.

```css
div {
text-align: center;
}

p {
text-align: justify;
}
```

**8. Text Decoration**

The `text-decoration` property adds decorations to the text, such as underlines, overlines, and line-throughs.

```css
a {
text-decoration: none; /* Removes underline from links */
}

del {
text-decoration: line-through;
}
```

**9. Text Shadow**

The `text-shadow` property adds a shadow effect to the text.

```css
h1 {
text-shadow: 2px 2px 5px gray;
}
```
Loading