CSS - Notes
CSS - Notes
CSS - Notes
by : Emmersive Learning
Join us :
Telegram : https://t.me/EmmersiveLearning
Youtube : https://www.youtube.com/@EmmersiveLearning/
CSS (Cascading Style Sheet
)
HTML vs CSS
Here's an outline of what we'll cover:
1. Introduction to CSS
2. CSS Syntax
3. Selectors
4. Properties and Values
5. Colours
6. Box Model
7. Text Styling
8. Layout
9. Responsive Design
1. Introduction to CSS
CSS stands for Cascading Style Sheets. It describes how HTML elements are to be displayed
on screen, paper, or in other media. CSS saves a lot of work as it can control the layout of
multiple web pages all at once.
2. Ways to Include CSS
There are three main ways to include CSS in your HTML document:
Inline Styles: Directly within the HTML element using the style attribute.
HTML
<h1 style="color: red;">This is inline styling</h1>
Internal Styles: Within the <head> section of your HTML document using the <style> tag.
HTML
<head>
<style>
body {
background-color: lightgray;
}
</style>
</head>
External Stylesheet: In a separate .css file linked to your HTML file using the <link> tag.
HTML
<link rel="stylesheet" href="styles.css">
3. CSS Syntax
CSS is written in rulesets. Each rule set consists of a selector and a declaration block.
CSS code:
selector {
property: value;
}
4. Selectors
Selectors are used to target the HTML elements you want to style.
Element Selector: Targets HTML elements directly.
css
Copy code
p {
color: blue;
}
CSS properties are used to define the styles for elements. Here are a few common properties:
Color: Sets the color of text.
css
Copy code
color: blue;
Properties
6. Colours
7. Box Model
Every HTML element is a box. The CSS box model describes the rectangular boxes generated
for elements in the document tree and consists of:
● Content: The actual content of the box, where text and images appear.
● Padding: Clears an area around the content (inside the border).
● Border: A border that goes around the padding (if any) and content.
● Margin: Clears an area outside the border.
css
Copy code
div {
width: 100px;
height: 100px;
padding: 10px;
border: 1px solid black;
margin: 10px;
}
8. Text Styling
●
Text Decoration: Adds decoration to the text.
css
Copy code
text-decoration: underline;
9. Layout
●
Position: Sets how an element is positioned in the document.
css
Copy code
position: absolute;
Responsive design ensures that web pages look good on all devices.
Would you like to dive deeper into any of these topics or have any specific questions?
CSS frameworks :
Resources
- W3schools : https://www.w3schools.com/css/default.asp
- MDN : https://developer.mozilla.org/en-US/docs/Web/CSS
- CSS Tricks :https://css-tricks.com/
- CSS reference : https://cssreference.io/