Module IV: Cascading style-sheet (CSS) in HTML
Introduction to Cascading Style Sheets (CSS), Types of Style Sheets (Inline,
Internal and External), CSS for Website Layout and Print Layout. Types of
various CSS Selectors, CSS properties: Type Properties, Background
Properties, Block Properties, Box Model Properties, List Properties, Border
Properties, Positioning Propeties.
___________________________________________________________________________
______
CASCADING STYLE SHEETS (CSS):
1. Introduction to CSS
What is CSS?
CSS (Cascading Style Sheets) is a stylesheet language used to
describe the presentation and formatting of web pages written
in HTML (HyperText Markup Language) or XML.
While HTML is used to structure the content (headings,
paragraphs, images, tables, etc.), CSS defines how that content
should appear—its color, layout, font, spacing, and even how it
adapts to different screen sizes (like mobile or desktop).
Example:
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
color: blue;
text-align: center;
}
p{
font-size: 18px;
color: darkgray;
, }
</style>
</head>
<body>
<h1>Welcome to CSS</h1>
<p>CSS makes web pages beautiful and structured.</p>
</body>
</html>
Why Use CSS?
Before CSS, web developers used only HTML attributes (like
<font>, <b>, <center>) for styling, which made web pages
bulky and inconsistent. CSS solved this problem by separating
content from presentation.
Advantages of CSS:
1. Separation of Content and Design – HTML for
structure, CSS for style.
2. Consistency – One stylesheet can style multiple pages.
3. Faster Page Loading – Less HTML code and easier
maintenance.
4. Better Accessibility – Layouts adjust automatically for
devices or print.
5. Reusability – The same stylesheet can be reused across
projects.
6. Improved SEO – Cleaner HTML means faster indexing by
search engines.
Introduction to Cascading Style Sheets (CSS), Types of Style Sheets (Inline,
Internal and External), CSS for Website Layout and Print Layout. Types of
various CSS Selectors, CSS properties: Type Properties, Background
Properties, Block Properties, Box Model Properties, List Properties, Border
Properties, Positioning Propeties.
___________________________________________________________________________
______
CASCADING STYLE SHEETS (CSS):
1. Introduction to CSS
What is CSS?
CSS (Cascading Style Sheets) is a stylesheet language used to
describe the presentation and formatting of web pages written
in HTML (HyperText Markup Language) or XML.
While HTML is used to structure the content (headings,
paragraphs, images, tables, etc.), CSS defines how that content
should appear—its color, layout, font, spacing, and even how it
adapts to different screen sizes (like mobile or desktop).
Example:
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
color: blue;
text-align: center;
}
p{
font-size: 18px;
color: darkgray;
, }
</style>
</head>
<body>
<h1>Welcome to CSS</h1>
<p>CSS makes web pages beautiful and structured.</p>
</body>
</html>
Why Use CSS?
Before CSS, web developers used only HTML attributes (like
<font>, <b>, <center>) for styling, which made web pages
bulky and inconsistent. CSS solved this problem by separating
content from presentation.
Advantages of CSS:
1. Separation of Content and Design – HTML for
structure, CSS for style.
2. Consistency – One stylesheet can style multiple pages.
3. Faster Page Loading – Less HTML code and easier
maintenance.
4. Better Accessibility – Layouts adjust automatically for
devices or print.
5. Reusability – The same stylesheet can be reused across
projects.
6. Improved SEO – Cleaner HTML means faster indexing by
search engines.