CSS 1 💻 Introduction
1 – Introduction
<link rel="stylesheet" href="styles.css">
<style>
p {
color: red;
}
</style>
<h1 style="color:blue">CSS Introduction</h1>
<p>Cascale Style Sheets</p>
<span>by Kronos</span>
span{
color: green;
}
CSS (Cascade Style Sheets) specifies the visual presentation of HTML document
You can style everything in an HTML document
With one CSS file you can change the layout to multiple HTML documents
There are 3 ways to use CSS:
inline → CSS is applied directly to an HTML element
internal → CSS is defined in head element of an HTML document
external → CSS is defines in a separate file. You import this file using link element inside the head element
Basic Syntax: selector { property: value; }
selector → selects the HTML element. It can be one element or groups of elements
common selectors → element (p, span), classes(.classname), ID(#idname), attribute([attribute=”value”])
property → various characteristics of an HTML element that can be controlled
color, font-size, margin,padding, border etc
value → the value you want to assign to the property
You can have multiple properties in a selector and always ends with ;