Glossary
- Background image
- Border color
- Border radius
- Border width
- Borders
- Class attribute
- Color
- Comment
- First-child selector
- Font family
- Font size
- Font style
- Font weight
- Height
- Linking a style sheet
- Margin
- N-th-child selector
- Overflow property
- Padding
- Pixels
- Position property
- Rounding an image
- Selectors
- Text align
- Transition property
- Width
CSS
Linking a style sheet in CSS
To include a style sheet in an HTML file, we use the link
element. <link>
is a self-closing empty element and it goes inside the head
element.
<head>
<link>
</head>
<body>
<h1>Water Puns</h1>
<p> Why does water never laugh at jokes? It's not a fan of dry
humor. </p>
</body>
To know what kind of file to include, the opening link
tag needs the rel
attribute set using rel="stylesheet"
.
<head>
<link rel="stylesheet">
</head>
<body>
<h1>Water puns</h1>
<p>Why are rivers amazing roommates? They go with the flow. </p>
</body>
To specify the style sheet's location, set the href
attribute to "style.css"
.
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Water Puns</h1>
<p> Why are oceans so meticulous?<br> They like to be pacific. </p>
</body>
Learn CSS for Free
Start learning now
To advance beyond this tutorial and learn CSS by doing, try the interactive experience of Mimo. Whether you're starting from scratch or brushing up your coding skills, Mimo helps you take your coding journey above and beyond.
Sign up or download Mimo from the App Store or Google Play to enhance your programming skills and prepare for a career in tech.