SlideShare a Scribd company logo
2
Most read
3
Most read
11
Most read
CSS
CASCADING STYLE SHEETS
CSS is used to define styles for web pages, including the design, layout and variations in
display for different devices and screen sizes.
Syntax:
Selector: {property: value;}
Ex: a {color : green;}
Comments:
A CSS comment starts with /* and ends with */. Comments can also span multiple lines:
p {
color: red;
/* This is a single-line comment */
text-align: center;
}
/* This is
a multi-line
comment */
Types of CSS
Inline
Internal External
<div style=“”></div> <style> ………</style> <link rel="stylesheet“ href=“”></link>
Selectors:
CSS selectors are used to "find" (or select) the HTML elements you want to style.
We can divide CSS selectors into five categories:
1. Simple selectors (select elements based on name, id, class)
2. Combinator selectors (select elements based on a specific relationship between them)
3. Pseudo-class selectors (select elements based on a certain state)
4. Pseudo-elements selectors (select and style a part of an element)
5. Attribute selectors (select elements based on an attribute or attribute value)
Box Model
The CSS box model is essentially a box that wraps around every HTML
element. It consists of: margins, borders, padding, and the actual
content.
Content - The content of the box, where text and images appear
Padding - Clears an area around the content. The padding is transparent
Border - A border that goes around the padding and content
Margin - Clears an area outside the border. The margin is transparent
Font-face
With @font-face rule, we can use our own fonts instead of default “web-fonts”.
Syntax:
@font-face{ font-properties}
Ex:
@font-face {
font-family: ’font-name’;
src: url(‘font-location/font-name.ttf’);
font-weight: bold;
}
selector{font-family: ‘font-name’;}
Display
The display property specifies if/how an element is displayed.
Every HTML element has a default display value depending on what type of
element it is. The default display value for most elements is block or inline.
Block-level Elements
• <div>
• <h1> - <h6>
• <p>
• <form>
• <header>
• <footer>
• <section>
Inline Elements
• <span>
• <a>
• <img>
Different Values
• inherit
• none
• block
• inline
• inline-block
• table
Position
The position CSS property sets how an element is positioned in a document.
The top , right , bottom , and left properties determine the final location of positioned elements.
1. Static: Default value. Elements render in order, as they appear in the document flow
2. Relative: The element is positioned relative to its normal position
3. Absolute: The element is positioned relative to its first positioned (not static) ancestor element
4. Fixed: The element is positioned relative to the browser window
5. Sticky: The element is positioned based on the user's scroll position
Syntax:
Position: static | absolute |fixed |relative | sticky;
Media Queries
The @media rule is used in media queries to apply different styles for different media types/devices.
Media queries can be used to check many things, such as:
• width and height of the viewport
• width and height of the device
• orientation (is the tablet/phone in landscape or portrait mode?)
• resolution
Using media queries are a popular technique for delivering a tailored style sheet (responsive web design) to
desktops, laptops, tablets, and mobile phones.
You can also use media queries to specify that certain styles are only for printed documents or for screen
readers (mediatype: print, screen, or speech).
Syntax:
@media not|only mediatype and (mediafeature and|or|not mediafeature) {
CSS-Code;
}
Ex:
@media screen and (max-width: 600px) {
selector {
display: none;
}
}
We can also have different stylesheets for different media, like this:
<link rel="stylesheet" media="screen and (min-width: 900px)" href="widescreen.css">
<link rel="stylesheet" media="screen and (max-width: 600px)" href="smallscreen.css">
MediaQueries
• All
• Print
• Screen
• speech
/* When the width is between 600px and 900px OR above 1100px -
change the appearance of <div> */
@media screen and (max-width: 900px) and (min-width: 600px), (min-
width: 1100px) {
………………………..
}
}
- Bala

More Related Content

PPTX
Css syntax, teachin presentation
PPT
Introduction to Cascading Style Sheets (CSS)
PPT
Introduction to CSS
PPT
Cascading Style Sheets (CSS) help
PDF
Introduction to CSS
PPT
PPTX
Css ppt
Css syntax, teachin presentation
Introduction to Cascading Style Sheets (CSS)
Introduction to CSS
Cascading Style Sheets (CSS) help
Introduction to CSS
Css ppt

What's hot (19)

PPTX
Welcome to css!
PPTX
Week 12 CSS - Review from last week
PPTX
Cascading Style Sheet
PPTX
Android training (android style)
PPT
An Introduction to CSS
PPTX
What is css
ODP
Introduction to css & its attributes with syntax
PPTX
Introduction to CSS
PPTX
Complete Lecture on Css presentation
PPT
CSS
PPT
Cascading Style Sheets(CSS)
PPSX
Introduction to css
PPTX
Web Technology
PPT
Cascading Style Sheets
PPTX
CSS Basic Introduction, Rules, And Tips
PPT
PPTX
XML_schema_Structure
Welcome to css!
Week 12 CSS - Review from last week
Cascading Style Sheet
Android training (android style)
An Introduction to CSS
What is css
Introduction to css & its attributes with syntax
Introduction to CSS
Complete Lecture on Css presentation
CSS
Cascading Style Sheets(CSS)
Introduction to css
Web Technology
Cascading Style Sheets
CSS Basic Introduction, Rules, And Tips
XML_schema_Structure
Ad

Similar to Css (20)

PPTX
Beginners css tutorial for web designers
PDF
Webpage style with CSS
PPTX
Cordova training - Day 2 Introduction to CSS 3
PPTX
session2 cascading style sheet course.pptx
PPTX
session2 css cascade style sheet course.pptx
PPTX
session2_cascading_style_sheet_cssc.pptx
PPTX
Howcssworks 100207024009-phpapp01
PPTX
Cascading style sheet, CSS Box model, Table in CSS
PPTX
Chapter_1_Web_Technologies_Basics (CSS)_Part_2.pptx
PDF
Pfnp slides
PPTX
PPTX
PPTX
css v1 guru
PPTX
Css ms megha
PPT
gdg_workshop 4 on web development HTML & CSS
PPTX
CSS introduction
PPTX
Introduction to basics of css, overview, syntax and so on
PDF
CSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
PPTX
Cascading Styling Sheets(CSS) simple design language intended to transform th...
Beginners css tutorial for web designers
Webpage style with CSS
Cordova training - Day 2 Introduction to CSS 3
session2 cascading style sheet course.pptx
session2 css cascade style sheet course.pptx
session2_cascading_style_sheet_cssc.pptx
Howcssworks 100207024009-phpapp01
Cascading style sheet, CSS Box model, Table in CSS
Chapter_1_Web_Technologies_Basics (CSS)_Part_2.pptx
Pfnp slides
css v1 guru
Css ms megha
gdg_workshop 4 on web development HTML & CSS
CSS introduction
Introduction to basics of css, overview, syntax and so on
CSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
Cascading Styling Sheets(CSS) simple design language intended to transform th...
Ad

Recently uploaded (20)

PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
cuic standard and advanced reporting.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Spectroscopy.pptx food analysis technology
PPTX
Big Data Technologies - Introduction.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Chapter 3 Spatial Domain Image Processing.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Encapsulation_ Review paper, used for researhc scholars
MYSQL Presentation for SQL database connectivity
Diabetes mellitus diagnosis method based random forest with bat algorithm
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
cuic standard and advanced reporting.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Spectroscopy.pptx food analysis technology
Big Data Technologies - Introduction.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Unlocking AI with Model Context Protocol (MCP)
Per capita expenditure prediction using model stacking based on satellite ima...
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Network Security Unit 5.pdf for BCA BBA.
Chapter 3 Spatial Domain Image Processing.pdf

Css

  • 2. CSS is used to define styles for web pages, including the design, layout and variations in display for different devices and screen sizes. Syntax: Selector: {property: value;} Ex: a {color : green;}
  • 3. Comments: A CSS comment starts with /* and ends with */. Comments can also span multiple lines: p { color: red; /* This is a single-line comment */ text-align: center; } /* This is a multi-line comment */
  • 4. Types of CSS Inline Internal External <div style=“”></div> <style> ………</style> <link rel="stylesheet“ href=“”></link>
  • 5. Selectors: CSS selectors are used to "find" (or select) the HTML elements you want to style. We can divide CSS selectors into five categories: 1. Simple selectors (select elements based on name, id, class) 2. Combinator selectors (select elements based on a specific relationship between them) 3. Pseudo-class selectors (select elements based on a certain state) 4. Pseudo-elements selectors (select and style a part of an element) 5. Attribute selectors (select elements based on an attribute or attribute value)
  • 6. Box Model The CSS box model is essentially a box that wraps around every HTML element. It consists of: margins, borders, padding, and the actual content. Content - The content of the box, where text and images appear Padding - Clears an area around the content. The padding is transparent Border - A border that goes around the padding and content Margin - Clears an area outside the border. The margin is transparent
  • 7. Font-face With @font-face rule, we can use our own fonts instead of default “web-fonts”. Syntax: @font-face{ font-properties} Ex: @font-face { font-family: ’font-name’; src: url(‘font-location/font-name.ttf’); font-weight: bold; } selector{font-family: ‘font-name’;}
  • 8. Display The display property specifies if/how an element is displayed. Every HTML element has a default display value depending on what type of element it is. The default display value for most elements is block or inline. Block-level Elements • <div> • <h1> - <h6> • <p> • <form> • <header> • <footer> • <section> Inline Elements • <span> • <a> • <img> Different Values • inherit • none • block • inline • inline-block • table
  • 9. Position The position CSS property sets how an element is positioned in a document. The top , right , bottom , and left properties determine the final location of positioned elements. 1. Static: Default value. Elements render in order, as they appear in the document flow 2. Relative: The element is positioned relative to its normal position 3. Absolute: The element is positioned relative to its first positioned (not static) ancestor element 4. Fixed: The element is positioned relative to the browser window 5. Sticky: The element is positioned based on the user's scroll position Syntax: Position: static | absolute |fixed |relative | sticky;
  • 10. Media Queries The @media rule is used in media queries to apply different styles for different media types/devices. Media queries can be used to check many things, such as: • width and height of the viewport • width and height of the device • orientation (is the tablet/phone in landscape or portrait mode?) • resolution Using media queries are a popular technique for delivering a tailored style sheet (responsive web design) to desktops, laptops, tablets, and mobile phones. You can also use media queries to specify that certain styles are only for printed documents or for screen readers (mediatype: print, screen, or speech).
  • 11. Syntax: @media not|only mediatype and (mediafeature and|or|not mediafeature) { CSS-Code; } Ex: @media screen and (max-width: 600px) { selector { display: none; } } We can also have different stylesheets for different media, like this: <link rel="stylesheet" media="screen and (min-width: 900px)" href="widescreen.css"> <link rel="stylesheet" media="screen and (max-width: 600px)" href="smallscreen.css"> MediaQueries • All • Print • Screen • speech /* When the width is between 600px and 900px OR above 1100px - change the appearance of <div> */ @media screen and (max-width: 900px) and (min-width: 600px), (min- width: 1100px) { ……………………….. } }