CSS Tutorial



CSS WEB FONTS


CSS Web Fonts

Web fonts are fonts that you can embed into your web page, giving you more design freedom. Instead of relying on default system fonts, you can use custom fonts from services like Google Fonts or Adobe Fonts, ensuring consistency across devices and browsers.

๐Ÿ“ Syntax:

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');

body {
  font-family: 'Roboto', sans-serif;
}
  

๐Ÿงช Live Example:

Welcome to CSS Web Fonts!

This text is using the 'Roboto' font from Google Fonts.

๐Ÿ”ง Common Properties:

  • @import โ†’ Imports the font from an external source like Google Fonts.
  • font-family: โ†’ Defines the font used for the text (e.g., 'Roboto', sans-serif).
  • font-weight: โ†’ Controls the thickness of the font (e.g., 400 for normal, 700 for bold).
  • font-size: โ†’ Sets the size of the font.

๐Ÿ“ฑ Responsive Layout Tip:

When using web fonts, it's best to keep your font sizes flexible. Use relative units like em or rem instead of fixed pixel sizes to ensure better responsiveness across different screen sizes.


๐ŸŒŸ Enjoyed Learning with Us?

Help others discover Technorank Learning by sharing your honest experience.
Your support inspires us to keep building!

Leave a Google Review