The font-family property sets the typeface. Always include a fallback:
p {
font-family: "Helvetica", Arial, sans-serif;
}Use font-size to control text size. Units include:
px: fixed size (e.g., 16px)em: relative to parentrem: relative to root%: relative to parenth1 {
font-size: 32px;
}The font-weight property defines boldness. Values:
normalbold100 to 900strong {
font-weight: bold;
}The font-style property is used to italicize or slant text.
normalitalicobliqueem {
font-style: italic;
}You can use web fonts like Google Fonts. Either import via CSS:
@import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');
body {
font-family: 'Roboto', sans-serif;
}Or with a <link> in your HTML:
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">You can explore different fonts that fit your preferences at https://fonts.google.com/
Use the Roboto font and apply formatting:
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
<p style={{
fontFamily: "'Roboto', sans-serif",
fontSize: "18px",
fontWeight: "bold",
fontStyle: "italic"
}}>
This paragraph uses the Roboto font with custom styling.
</p>You can copy and paste this code in your IDE to run!
Ask the AI if you need help understanding or want to dive deeper in any topic