Content ITV PRO
This is Itvedant Content department
Learning Outcome
5
Explain cascade, inheritance, and specificity.
4
Use DevTools to inspect webpage styles.
3
Apply inline, internal, and external CSS.
2
Write CSS using correct syntax rules.
1
Understand the purpose and benefits of CSS.
Would you be excited to live in it if it looked like this?
Plain gray walls
No paint
No curtains
No furniture
No lighting
No decoration
You can enter it, live in it, and use all its rooms.
Does it look attractive?
Does it feel welcoming?
Does it reflect your personality?
To make the plain webpage visually appealing and attractive, we use CSS.
CSS stands for Cascading Style Sheets.
It is used to style and design HTML webpages.
CSS stands for Cascading Style Sheets.
It is used to style and design HTML webpages.
Fonts
Colors
Layouts
Spacing
Borders
Alignment
Style multiple elements simultaneously with less code.
Write once, apply everywhere across the website.
Separation of concerns makes HTML readable.
Uniform look and feel across all webpages.
Adapt layout seamlessly to different screen sizes.
style.css
h1{
color : blue ;
font-size : 30px ;
}
style.css
h1{
color : blue ;
font-size : 30px ;
}
style.css
h1{
color : blue ;
font-size : 30px ;
}
Single rule
Multiple rules
Comments are notes written inside CSS code.
Browser ignores comments during execution.
Syntax
/* This is a CSS comment */
Applied directly inside HTML elements using the style="" attribute.
Quick fixes
Single page styles
Best practice
Defined within a <style> tag inside the HTML file's <head>.
Written in a separate .css file and linked to the HTML document.
//Index.html
<style>
h1{
color:blue;
}
</style>External css
//Index.html
<head>
<link rel="stylesheet"
href="style.css">
</head>Links to
//style.css
h1{
color:blue;
}//Index.html
<h1 style="color:red">
Welcome
</h1>Browser developer tools (DevTools) are built-in toolkits found in all modern web browsers. They allow you to inspect the HTML, CSS, and JavaScript of any webpage, monitor network traffic, and test responsiveness across different device sizes
Right click -> Inspect
Keyboard -> Press F12
" A process where multiple styles are applied, and the browser decides which style should take priority."
Highest
" A process where multiple styles are applied, and the browser decides which style should take priority."
Medium
Lowest
Inheritance is a feature in CSS where some properties applied to a parent element are automatically passed to its child elements.
body
color: darkgray;
font-family: Arial;
<p> tag inherits
color: darkgray;
font-family: Arial;
Commonly Inherited Properties
Font styles
Text color
Line-height
Visibility
Specificity is the rule CSS uses to determine which style should be applied when multiple CSS selectors target the same element.
Highest
ID Selector
Class Selector
High
Medium
Low
Inline CSS
Element Selector
Summary
5
Specificity determines which style gets applied.
4
CSS can be inline, internal, external.
3
Selectors target elements using CSS rules.
2
CSS improves design, layout, and consistency.
1
CSS styles and beautifies HTML webpages.
Quiz
What does CSS stand for?
A. Computer Style Sheets
B. Cascading Style Sheets
C. Creative Style Sheets
D. Color Style Sheets
What does CSS stand for?
A. Computer Style Sheets
B. Cascading Style Sheets
C. Creative Style Sheets
D. Color Style Sheets
Quiz-Answer
By Content ITV