You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: curriculum/challenges/english/25-front-end-development/review-responsive-web-design/671a98927af7829722697dc2.md
Review the concepts below to prepare for the upcoming quiz.
11
11
12
+
## Responsive Web Design
13
+
14
+
-**Definition**: The core principle of responsive design is adaptability – the ability of a website to adjust its layout and content based on the screen size and capabilities of the device it's being viewed on.
15
+
-**Fluid grids**: These use relative units like percentages instead of fixed units like pixels, allowing content to resize and reflow based on screen size.
16
+
-**Flexible images**: These are set to resize within their containing elements, ensuring they don't overflow their containers on smaller screens.
17
+
18
+
## Media Queries
19
+
20
+
-**Definition**: This allows developers to apply different styles based on the characteristics of the device, primarily the viewport width.
21
+
22
+
```css
23
+
@mediascreenand (min-width: 768px) {
24
+
/* Styles for screens at least 768px wide */
25
+
}
26
+
```
27
+
28
+
-**`all` Media Type**: This is suitable for all devices. This is the default if no media type is specified.
29
+
-**`print` Media Types**: This is intended for paged material and documents viewed on a screen in print preview mode.
30
+
-**`screen` Media Types**: This is intended primarily for screens.
31
+
-**`aspect-ratio`**: This describes the ratio between the width and height of the viewport.
32
+
33
+
```css
34
+
@mediascreenand (aspect-ratio: 16/9) {
35
+
/* Styles for screens with a 16:9 aspect ratio */
36
+
}
37
+
```
38
+
39
+
-**`orientation`**: This is used to indicate whether the device is in landscape or portrait orientation.
40
+
41
+
```css
42
+
@mediascreenand (orientation: landscape) {
43
+
/* Styles for landscape orientation */
44
+
}
45
+
```
46
+
47
+
-**`resolution`**: This is used to describe the resolution of the output device in dots per inch (dpi) or dots per centimeter (dpcm).
48
+
49
+
```css
50
+
@mediascreenand (min-resolution: 300dpi) {
51
+
/* Styles for high-resolution screens */
52
+
}
53
+
```
54
+
55
+
-**`hover`**: This is used to test whether the primary input mechanism can hover over elements.
56
+
57
+
```css
58
+
@media (hover: hover) {
59
+
/* Styles for devices that support hover */
60
+
}
61
+
```
62
+
63
+
-**`prefers-color-scheme`**: This is used to detect if the user has requested a light or dark color theme.
64
+
-**Media Queries and Logical Operators**: The `and` operator is used to combine multiple media features, while `not` and `only` can be used to negate or isolate media queries.
65
+
66
+
```css
67
+
@mediascreenand (min-width: 768px) and (orientation: landscape) {
68
+
/* Styles for landscape screens at least 768px wide */
69
+
}
70
+
```
71
+
72
+
## Common Media Breakpoints
73
+
74
+
-**Definition**: Media breakpoints are specific points in a website's design where the layout and content adjust to accommodate different screen sizes. There are some general breakpoints that you can use to target phones, tablets and desktop screens. But it is not wise to try to chase down every single possible screen size for different devices.
75
+
76
+
```css
77
+
/* Styles for screens wider than 768px */
78
+
@mediascreenand (min-width: 768px) {
79
+
body {
80
+
font-size: 1.125rem;
81
+
}
82
+
}
83
+
```
84
+
85
+
-**Small Devices (smartphones)**: up to 640px
86
+
-**Medium Devices (tablets)**: 641px to 1024px
87
+
-**Large Devices (desktops)**: 1025px and larger
88
+
89
+
## Mobile first approach
90
+
91
+
-**Definition**: The `mobile-first` approach is a design philosophy and development strategy in responsive web design that prioritizes creating websites for mobile devices before designing for larger screens.
0 commit comments