Golang Tutorials - Learn Go Programming with Easy Step-by-Step Guides

Explore comprehensive Golang tutorials for beginners and advanced programmers. Learn Go programming with easy-to-follow, step-by-step guides, examples, and practical tips to master Go language quickly.

Fonts in CSS

Fonts in CSS

? Fonts in CSS

The font properties in CSS let you control the typography of text — including font family, size, weight, style, and more.


Key Font-Related Properties

PropertyDescriptionExample
font-familySpecifies the font or font stack to usefont-family: Arial, sans-serif;
font-sizeControls the size of the fontfont-size: 16px; or 1.2rem
font-weightSets the thickness (boldness) of the fontfont-weight: normal; or bold; or 400, 700
font-styleItalicize or oblique textfont-style: normal;, italic;, oblique;
font-variantControls small caps and other typographic variantsfont-variant: small-caps;
line-heightSets the height between lines of textline-height: 1.5;
letter-spacingControls spacing between lettersletter-spacing: 0.05em;
word-spacingControls spacing between wordsword-spacing: 0.1em;

Using font-family

You can specify multiple fonts as a fallback stack, in case the first font isn’t available:

body {  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;}

Example: Styling Text

h1 {  font-family: 'Georgia', serif;  font-size: 2.5rem;  font-weight: 700;  font-style: italic;  line-height: 1.2;  letter-spacing: 0.05em;}

Web Fonts (Google Fonts)

You can use external fonts by linking them in HTML or importing via CSS:

<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
body {  font-family: 'Roboto', sans-serif;}

Shorthand font Property

You can use the shorthand to set multiple font properties at once:

p {  font: italic small-caps bold 16px/1.5 "Arial", sans-serif;}

Order: font-style font-variant font-weight font-size/line-height font-family


If you want, I can help you pick and apply fonts, or show examples of combining font properties!

Disclaimer for AI-Generated Content:
The content provided in these tutorials is generated using artificial intelligence and is intended for educational purposes only.
html
docker
php
kubernetes
golang
mysql
postgresql
mariaDB
sql