How should the overall font size be set for the idea?
Multiple methods can be used to set the global font size.
- change the wording to be more natural:
HTML
html {
font-size: 16px;
}
This will change the font size on the entire page to 16 pixels.
- physical structure
body {
font-size: 16px;
}
This will result in all text on the entire page being 16 pixels in size, but in some cases, the body selector may not be able to override specific font size settings that have already been applied to other elements.
- the grounds are justified
html {
font-size: 16px;
}
body {
font-size: 1rem;
}
This method allows for relative setting based on the root element’s font size, making it easier to adapt to different devices and screen sizes.
- He doesn’t like spicy food.
html {
font-size: 16px;
}
body {
font-size: 1em;
}
Similar to the rem unit, the em unit is also based on the font size of the parent element for its setting.
These methods can be placed at the beginning of the CSS file or set in the