SlideShare a Scribd company logo
What is CSS?
CSS stands for Cascading Style Sheets.
CSS describes how HTML elements are to be
displayed on screen, paper, or in other media .
CSS saves a lot of work.
It can control the layout of multiple web pages
all at once.
External stylesheets are stored in CSS files.
Why Use CSS?
CSS is used to define styles for your web pages,
including the design, layout and variations in
display for different devices and screen sizes.
CSS Solved a Big Problem
HTML was NEVER intended to contain tags for formatting a web page! HTML was
created to describe the content of a web page, like:
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
When tags like <font>, and color attributes were added to the HTML 3.2 specification,
it started a nightmare for web developers. Development of large websites, where
fonts and color information were added to every single page, became a long and
expensive process to solve this problem, the World Wide Web Consortium (W3C)
created CSS.
CSS removed the style formatting from the HTML page!
CSS Syntax
A CSS rule consists of a selector and a
declaration block.
The selector points to the HTML element you
want to style
The declaration block contains one or more
declarations separated by semicolons.
Each declaration includes a CSS property name
and a value, separated by a colon.
Multiple CSS declarations are separated with
semicolons, and declaration blocks are
surrounded by curly braces.
Advantages of CSS
CSS saves time.
You can write CSS once and then reuse the same sheet in multiple
HTML pages.
You can define a style for each HTML element and apply it to as many
Web pages as you want.
Easy maintenance − To make a global change, simply change the
style, and all elements in all the web pages will be updated
automatically.
Global web standards − Now HTML attributes are being
deprecated and it is being recommended to use CSS.
So it's a good idea to start using CSS in all the HTML pages to make
them compatible with future browsers.
Platform Independence − The Script offer consistent platform
independence and can support latest browsers as well.
Disadvantages of CSS
 Browser Compatibility: CSS works differently on different browsers. Internet
Explorer and Opera supports CSS as a different logic.
 Different syntax to HTML: CSS as developed independently of HTML and uses a
different syntax, so web developer has to lean two sets of formatting syntax
instead of one.
 Lack of security: CSS is an open text based system. There is no built-in
security and anyone with read/ write access to website can disturb the
formatting by changing CSS file.
 Example
 In this example all <p> elements will be center-aligned, with a red text color:
<!DOCTYPE html>
<html>
<head>
<style>
p {
text-align: center;
color: red;
}
</style>
</head>
<body>
<p>Every paragraph will be affected by the style.</p>
<p id="para1">Me too!</p>
<p>And me!</p>
</body>
</html>
Example Explained
p is a selector in CSS (it points to the HTML element you want to style: <p>).
Using CSS
CSS can be added to HTML documents in 3 ways:
Inline - by using the style attribute inside HTML elements
Internal - by using a <style> element in the <head> section
External - by using a <link> element to link to an external CSS file
The most common way to add CSS, is to keep the styles in external CSS files.
Inline CSS
We can use style attribute of any HTML element to define style rules. These elements
will be applied to that element only.
Syntax:
<element style=“style rule”>
Example:-
<!DOCTYPE html>
<html>
<body>
<h1 style="color:blue;">A Blue Heading</h1>
<p style="color:red;">A red paragraph.</p>
</body>
</html>
Internal CSS or Embedded CSS
An internal CSS is used to define a style for a single HTML page.
An internal CSS is defined in the <head> section of an HTML page, within
a <style> element.
The following example sets the text color of ALL the <h1> elements (on that page) to
blue, and the text color of ALL the <p> elements to red. In addition, the page will be
displayed with a "powderblue" background color:
<!DOCTYPE html>
<html>
<head>
<style>
body {background-color: powderblue;}
h1 {color: blue;}
p {color: red;}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
External CSS
 An external style sheet is used to define the style for many HTML pages.
 With an external style sheet, you can change the look of an entire web site,
by changing one file!
 The <link> element can be used to include an external style sheet file in
HTML document.
 An external style sheet is a separate text file with .CSS extension.
 The <LINK> tag goes in header section.
EXAMPLE:
code for external style sheet
body {
background-color: powderblue;
}
h1 {
color: blue;
}
p {
color: red;
}
code for HTML DOCUMENT
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Imported CSS
 @imported rule statement is used to import an external style sheet in a
manner similer to <LINK> element.
 The @import rule statement goes inside the head section.
 Syntax:
<head>
<style type=“text/css”>
@import “url”;
</style>
</head>
Example:
Body{
background-color : light blue;
font-family: impact;
}
H1,h2{
font weight:bold;
font size:24pt;
color:red;
}
Note: save above external style sheet with name “ext.css”
Code to import external css in html
document
<html>
<head>
<style type=“text/css”>
@import url(“ext.css”);
</style>
</head>
<body>
<h1> WELCOME TO THE WORLD OF STYLE SHEET</h1>
<h2> This is how to import External style sheet</h2>
</body>
</html>
Styling with css properties
 Background properties:
Property Description values
Background-color Sets background color of
element
Color_nmae(like-red)
Background-image Sets background image
for <body>element
url(“image-file”)
Background-position Sets starting position of
a background image
Center top,left
center,left top,center
bottom, right
center,left bottom,right
bottom,right center
Background-size Specifies size of
background images
Auto
Percentage
cover
<html>
<head>
<style type=“text/css”>
Body
{
background-color:pink;
background-image:url(“C:UsersbharatDesktopth.jpg”);
background-position: center center;background-size:45% 65%;
}
</style>
</head>
<body>
<h2>applying background properties</h2>
</body>
<html>
 Text properties
Property Description Values
Color Sets the color of text Color_name
Line_height Sets the distances
between lines
Normal,number,length,%
Letter-spacing Increase and decrease
spaces between
characters
Normal,length
Text-align Aligns text in an element Left,right,center justify
Text-decoration` Adds decoration to text None,underline,overline,li
ne-through
Text-indent Indent the first line of
text in an element
Length,%
Text-transform Controls the letters in an
element
None,capitalize,uppercase
,lowercase
 Font Properties:
Property Description Values
Font-family Specifies font family for text Family-name(like-Arial)
Font-size Specifies the font size of text Xx-small,x-
small,small,medium,large,x-
large,xx-
large,smaller,larger,length(like-
20pt)
Font-style Specifies font style for text Normal,italic,oblique
Font-variant Specifies whether or not a text
should be displayed in a small-
caps font
Normal,small-caps
Font-weight Specifies the weight of a font Normal,bold,bolder,lighter
Id slector
 The CSS id Selector
 The id selector uses the id attribute of an HTML element to select a specific
element.
 The id of an element is unique within a page, so the id selector is used to
select one unique element!
 To select an element with a specific id, write a hash (#) character, followed
by the id of the element.
<!DOCTYPE html>
<html>
<head>
<style>
#para1 {
text-align: center;
color: red;
}
</style>
</head>
<body>
<p id="para1">Hello World!</p>
<p>This paragraph is not affected by the style.</p>
</body>
</html>
The CSS class Selector
The class selector selects HTML elements with a specific class attribute.
To select elements with a specific class, write a period (.) character, followed by
the class name.
Example
In this example all HTML elements with class="center" will be red and center-
aligned:
<!DOCTYPE html>
<html>
<head>
<style>
.center {
text-align: center;
color: red;
}
</style>
</head>
<body>
<h1 class="center">Red and center-aligned heading</h1>
<p class="center">Red and center-aligned paragraph.</p>
</body>
</html>

More Related Content

PPTX
What is CSS.pptx power point presentation
Coderkids
 
PPTX
Cascading style sheet, CSS Box model, Table in CSS
SherinRappai
 
PPTX
Lecture-6.pptx
vishal choudhary
 
PPTX
Unitegergergegegegetgegegegegegeg-2-CSS.pptx
VikasTuwar1
 
PDF
CSS notes
Rajendra Prasad
 
PDF
cascading style sheets ppt.sildeshower phone view
kedaringle994
 
PPTX
Introduction to CSS
Folasade Adedeji
 
DOC
Css introduction
vishnu murthy
 
What is CSS.pptx power point presentation
Coderkids
 
Cascading style sheet, CSS Box model, Table in CSS
SherinRappai
 
Lecture-6.pptx
vishal choudhary
 
Unitegergergegegegetgegegegegegeg-2-CSS.pptx
VikasTuwar1
 
CSS notes
Rajendra Prasad
 
cascading style sheets ppt.sildeshower phone view
kedaringle994
 
Introduction to CSS
Folasade Adedeji
 
Css introduction
vishnu murthy
 

Similar to properties of css.pptx power pointpresentation (20)

PPT
working with internet technologies using CSS
nazimsattar
 
PPT
Cascading Style Sheet
Meenakshi Paul
 
PDF
TUTORIAL DE CSS 2.0
Vladimir Valencia
 
PPTX
HTML to CSS Basics Exer 2.pptx
JJFajardo1
 
PPTX
Chapter_1_Web_Technologies_Basics (CSS)_Part_2.pptx
eyasu6
 
PPTX
Web Programming-css.pptx
MarwaAnany1
 
PDF
"Innovative Web Design & Development Hub
kyereernest560
 
PDF
Web Design Course: CSS lecture 2
Gheyath M. Othman
 
PPTX
4_css_intro.pptx. this ppt is based on css which is the required of web deve...
sindwanigripsi
 
PPTX
css1.pptx
Pandiya Rajan
 
PDF
Advanced Web Programming Chapter 8
RohanMistry15
 
PPTX
WEBSITE DESIGN AND DEVELOPMENT WITH CASCADING STYLE SHEETS(CSS)
brianbyamukama302
 
PPTX
INTRODUCTIONS OF CSS
SURYANARAYANBISWAL1
 
PPTX
Workshop 2 Slides.pptx
DaniyalSardar
 
PPTX
Welcome to css!
sidneyodingo
 
PDF
Introduction to css
Joseph Gabriel
 
PPTX
Web Designing Lecture 2 in Software.pptx
abpassion478
 
PPTX
CSS.pptx
PushpaLatha551681
 
PPTX
Web Design Assignment 1
beretta21
 
DOC
Css introduction
Sridhar P
 
working with internet technologies using CSS
nazimsattar
 
Cascading Style Sheet
Meenakshi Paul
 
TUTORIAL DE CSS 2.0
Vladimir Valencia
 
HTML to CSS Basics Exer 2.pptx
JJFajardo1
 
Chapter_1_Web_Technologies_Basics (CSS)_Part_2.pptx
eyasu6
 
Web Programming-css.pptx
MarwaAnany1
 
"Innovative Web Design & Development Hub
kyereernest560
 
Web Design Course: CSS lecture 2
Gheyath M. Othman
 
4_css_intro.pptx. this ppt is based on css which is the required of web deve...
sindwanigripsi
 
css1.pptx
Pandiya Rajan
 
Advanced Web Programming Chapter 8
RohanMistry15
 
WEBSITE DESIGN AND DEVELOPMENT WITH CASCADING STYLE SHEETS(CSS)
brianbyamukama302
 
INTRODUCTIONS OF CSS
SURYANARAYANBISWAL1
 
Workshop 2 Slides.pptx
DaniyalSardar
 
Welcome to css!
sidneyodingo
 
Introduction to css
Joseph Gabriel
 
Web Designing Lecture 2 in Software.pptx
abpassion478
 
Web Design Assignment 1
beretta21
 
Css introduction
Sridhar P
 
Ad

More from Coderkids (8)

PPTX
Authorization Pattern.pptx power point s
Coderkids
 
PPTX
Informed search algorithm.pptx power poi
Coderkids
 
PPTX
Requirement engineering.pptx power point
Coderkids
 
PPTX
personal-and-team-process-models.pptx po
Coderkids
 
PPTX
Artificial Intelligence.pptx power point
Coderkids
 
PPTX
282600430-Specialized-Process-Models.pptx
Coderkids
 
PPTX
Agile process model powerpoint presentat
Coderkids
 
PPTX
personal-and-team-process-models.pptx in
Coderkids
 
Authorization Pattern.pptx power point s
Coderkids
 
Informed search algorithm.pptx power poi
Coderkids
 
Requirement engineering.pptx power point
Coderkids
 
personal-and-team-process-models.pptx po
Coderkids
 
Artificial Intelligence.pptx power point
Coderkids
 
282600430-Specialized-Process-Models.pptx
Coderkids
 
Agile process model powerpoint presentat
Coderkids
 
personal-and-team-process-models.pptx in
Coderkids
 
Ad

Recently uploaded (20)

PPTX
How to Manage Global Discount in Odoo 18 POS
Celine George
 
PPTX
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
PDF
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
PPTX
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
PPTX
vedic maths in python:unleasing ancient wisdom with modern code
mistrymuskan14
 
PPTX
Skill Development Program For Physiotherapy Students by SRY.pptx
Prof.Dr.Y.SHANTHOSHRAJA MPT Orthopedic., MSc Microbiology
 
PPTX
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
PPTX
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
DOCX
Action Plan_ARAL PROGRAM_ STAND ALONE SHS.docx
Levenmartlacuna1
 
PDF
7.Particulate-Nature-of-Matter.ppt/8th class science curiosity/by k sandeep s...
Sandeep Swamy
 
PDF
Exploring-Forces 5.pdf/8th science curiosity/by sandeep swamy notes/ppt
Sandeep Swamy
 
PDF
Arihant Class 10 All in One Maths full pdf
sajal kumar
 
PPTX
IMMUNIZATION PROGRAMME pptx
AneetaSharma15
 
PPTX
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
PPTX
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
PDF
Types of Literary Text: Poetry and Prose
kaelandreabibit
 
PDF
The Picture of Dorian Gray summary and depiction
opaliyahemel
 
PPT
Python Programming Unit II Control Statements.ppt
CUO VEERANAN VEERANAN
 
PDF
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
Sandeep Swamy
 
How to Manage Global Discount in Odoo 18 POS
Celine George
 
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
vedic maths in python:unleasing ancient wisdom with modern code
mistrymuskan14
 
Skill Development Program For Physiotherapy Students by SRY.pptx
Prof.Dr.Y.SHANTHOSHRAJA MPT Orthopedic., MSc Microbiology
 
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
Action Plan_ARAL PROGRAM_ STAND ALONE SHS.docx
Levenmartlacuna1
 
7.Particulate-Nature-of-Matter.ppt/8th class science curiosity/by k sandeep s...
Sandeep Swamy
 
Exploring-Forces 5.pdf/8th science curiosity/by sandeep swamy notes/ppt
Sandeep Swamy
 
Arihant Class 10 All in One Maths full pdf
sajal kumar
 
IMMUNIZATION PROGRAMME pptx
AneetaSharma15
 
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
Types of Literary Text: Poetry and Prose
kaelandreabibit
 
The Picture of Dorian Gray summary and depiction
opaliyahemel
 
Python Programming Unit II Control Statements.ppt
CUO VEERANAN VEERANAN
 
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
Sandeep Swamy
 

properties of css.pptx power pointpresentation

  • 1. What is CSS? CSS stands for Cascading Style Sheets. CSS describes how HTML elements are to be displayed on screen, paper, or in other media . CSS saves a lot of work. It can control the layout of multiple web pages all at once. External stylesheets are stored in CSS files.
  • 2. Why Use CSS? CSS is used to define styles for your web pages, including the design, layout and variations in display for different devices and screen sizes.
  • 3. CSS Solved a Big Problem HTML was NEVER intended to contain tags for formatting a web page! HTML was created to describe the content of a web page, like: <h1>This is a heading</h1> <p>This is a paragraph.</p> When tags like <font>, and color attributes were added to the HTML 3.2 specification, it started a nightmare for web developers. Development of large websites, where fonts and color information were added to every single page, became a long and expensive process to solve this problem, the World Wide Web Consortium (W3C) created CSS. CSS removed the style formatting from the HTML page!
  • 4. CSS Syntax A CSS rule consists of a selector and a declaration block. The selector points to the HTML element you want to style The declaration block contains one or more declarations separated by semicolons. Each declaration includes a CSS property name and a value, separated by a colon. Multiple CSS declarations are separated with semicolons, and declaration blocks are surrounded by curly braces.
  • 5. Advantages of CSS CSS saves time. You can write CSS once and then reuse the same sheet in multiple HTML pages. You can define a style for each HTML element and apply it to as many Web pages as you want. Easy maintenance − To make a global change, simply change the style, and all elements in all the web pages will be updated automatically. Global web standards − Now HTML attributes are being deprecated and it is being recommended to use CSS. So it's a good idea to start using CSS in all the HTML pages to make them compatible with future browsers. Platform Independence − The Script offer consistent platform independence and can support latest browsers as well.
  • 6. Disadvantages of CSS  Browser Compatibility: CSS works differently on different browsers. Internet Explorer and Opera supports CSS as a different logic.  Different syntax to HTML: CSS as developed independently of HTML and uses a different syntax, so web developer has to lean two sets of formatting syntax instead of one.  Lack of security: CSS is an open text based system. There is no built-in security and anyone with read/ write access to website can disturb the formatting by changing CSS file.
  • 7.  Example  In this example all <p> elements will be center-aligned, with a red text color:
  • 8. <!DOCTYPE html> <html> <head> <style> p { text-align: center; color: red; } </style> </head> <body> <p>Every paragraph will be affected by the style.</p> <p id="para1">Me too!</p> <p>And me!</p> </body> </html> Example Explained p is a selector in CSS (it points to the HTML element you want to style: <p>).
  • 9. Using CSS CSS can be added to HTML documents in 3 ways: Inline - by using the style attribute inside HTML elements Internal - by using a <style> element in the <head> section External - by using a <link> element to link to an external CSS file The most common way to add CSS, is to keep the styles in external CSS files.
  • 10. Inline CSS We can use style attribute of any HTML element to define style rules. These elements will be applied to that element only. Syntax: <element style=“style rule”> Example:- <!DOCTYPE html> <html> <body> <h1 style="color:blue;">A Blue Heading</h1> <p style="color:red;">A red paragraph.</p> </body> </html>
  • 11. Internal CSS or Embedded CSS An internal CSS is used to define a style for a single HTML page. An internal CSS is defined in the <head> section of an HTML page, within a <style> element. The following example sets the text color of ALL the <h1> elements (on that page) to blue, and the text color of ALL the <p> elements to red. In addition, the page will be displayed with a "powderblue" background color:
  • 12. <!DOCTYPE html> <html> <head> <style> body {background-color: powderblue;} h1 {color: blue;} p {color: red;} </style> </head> <body> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body> </html>
  • 13. External CSS  An external style sheet is used to define the style for many HTML pages.  With an external style sheet, you can change the look of an entire web site, by changing one file!  The <link> element can be used to include an external style sheet file in HTML document.  An external style sheet is a separate text file with .CSS extension.  The <LINK> tag goes in header section.
  • 14. EXAMPLE: code for external style sheet body { background-color: powderblue; } h1 { color: blue; } p { color: red; } code for HTML DOCUMENT <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="styles.css"> </head> <body> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body> </html>
  • 15. Imported CSS  @imported rule statement is used to import an external style sheet in a manner similer to <LINK> element.  The @import rule statement goes inside the head section.  Syntax: <head> <style type=“text/css”> @import “url”; </style> </head>
  • 16. Example: Body{ background-color : light blue; font-family: impact; } H1,h2{ font weight:bold; font size:24pt; color:red; } Note: save above external style sheet with name “ext.css”
  • 17. Code to import external css in html document <html> <head> <style type=“text/css”> @import url(“ext.css”); </style> </head> <body> <h1> WELCOME TO THE WORLD OF STYLE SHEET</h1> <h2> This is how to import External style sheet</h2> </body> </html>
  • 18. Styling with css properties  Background properties: Property Description values Background-color Sets background color of element Color_nmae(like-red) Background-image Sets background image for <body>element url(“image-file”) Background-position Sets starting position of a background image Center top,left center,left top,center bottom, right center,left bottom,right bottom,right center Background-size Specifies size of background images Auto Percentage cover
  • 19. <html> <head> <style type=“text/css”> Body { background-color:pink; background-image:url(“C:UsersbharatDesktopth.jpg”); background-position: center center;background-size:45% 65%; } </style> </head> <body> <h2>applying background properties</h2> </body> <html>
  • 20.  Text properties Property Description Values Color Sets the color of text Color_name Line_height Sets the distances between lines Normal,number,length,% Letter-spacing Increase and decrease spaces between characters Normal,length Text-align Aligns text in an element Left,right,center justify Text-decoration` Adds decoration to text None,underline,overline,li ne-through Text-indent Indent the first line of text in an element Length,% Text-transform Controls the letters in an element None,capitalize,uppercase ,lowercase
  • 21.  Font Properties: Property Description Values Font-family Specifies font family for text Family-name(like-Arial) Font-size Specifies the font size of text Xx-small,x- small,small,medium,large,x- large,xx- large,smaller,larger,length(like- 20pt) Font-style Specifies font style for text Normal,italic,oblique Font-variant Specifies whether or not a text should be displayed in a small- caps font Normal,small-caps Font-weight Specifies the weight of a font Normal,bold,bolder,lighter
  • 22. Id slector  The CSS id Selector  The id selector uses the id attribute of an HTML element to select a specific element.  The id of an element is unique within a page, so the id selector is used to select one unique element!  To select an element with a specific id, write a hash (#) character, followed by the id of the element.
  • 23. <!DOCTYPE html> <html> <head> <style> #para1 { text-align: center; color: red; } </style> </head> <body> <p id="para1">Hello World!</p> <p>This paragraph is not affected by the style.</p> </body> </html>
  • 24. The CSS class Selector The class selector selects HTML elements with a specific class attribute. To select elements with a specific class, write a period (.) character, followed by the class name. Example In this example all HTML elements with class="center" will be red and center- aligned:
  • 25. <!DOCTYPE html> <html> <head> <style> .center { text-align: center; color: red; } </style> </head> <body> <h1 class="center">Red and center-aligned heading</h1> <p class="center">Red and center-aligned paragraph.</p> </body> </html>