SlideShare a Scribd company logo
1 of 26
CSS
CSS stands for Cascading Style Sheets
It is the language for describing the presentation of Web pages, including
colours, layout, and fonts, thus making our web pages presentable to the users.
Purpose of CSS
CSS, or Cascading Style Sheets, is a language that is used in combination with HTML that
customizes how HTML elements will appear. CSS can define styles and change the layout
and design of a sheet.
Separating HTML code from CSS code
It is common practice to separate content code in HTML files from styling code in CSS
files. This can help make the code easier to maintain, by keeping the syntax for each file
CSS declarations
/*
CSS declaration format:
property-name: value;
*/
/* CSS declarations */
text-align: center;
color: purple;
width: 100px;
In CSS, a declaration is the key-value pair of a CSS property and its value. CSS declarations are used to
set style properties and construct rules to apply to individual or groups of elements. The property name
and value are separated by a colon, and the entire declaration must be terminated by a semi-colon.
CSS Rule Sets
h1 {
color: blue;
text-align: center;
}
A CSS rule set contains one or more selectors and one or more declarations. The
selector(s), which in this example is h1, points to an HTML element. The declaration(s),
which in this example are color: blue and text-align: center style the element with a
property and value. The rule set is the main building block of a CSS sheet.
Background Color
background-color: cyan;
The background-color CSS property controls the background color of elements.
Background Image
background-image: url("images/tiger.gif");
The background-image CSS property sets the background image of an element. An image
URL should be provided in the syntax url(“images/tiger.jpg") as the value of the property.
Font Family
h2 {
font-family: Verdana;
}
p {
font-family: "Courier New";
}
The font-family CSS property is used to specify the typeface in a rule set. Fonts must be available to the browser to
display correctly, either on the computer or linked as a web font. If a font value is not available, browsers will
display their default font. When using a multi-word font name, it is best practice to wrap them in quotes.
Font Size
font-size: 30px;
The font-size CSS property is used to set text sizes. Font size values can be many different units or types such as
pixels.
Font Weight
font-weight: bold;
The font-weight CSS property can be used to set the weight (boldness) of text. The
provided value can be a keyword such as bold /normal/inherit.
Text Align
text-align: right;
The text-align CSS property can be used to set the text alignment of inline contents. This
property can be set to these values: left, right, or center.
Setting foreground text color in CSS
p {
color : #2a2aff ;
}
Using the color property, foreground text color of an element can be set in CSS.
Color Name Keywords
h1 {
color: aqua;
}
li {
color: khaki;
}
Color name keywords can be used to set color property values for elements in CSS.
Setting border in CSS
h1 {
border:2px solid yellow
}
The border properties allow you to specify how the border of the box representing an element should look. The
border-style property allows you to select one of the following styles of border −
•solid − Border is a single solid line.
•dotted − Border is a series of dots.
•dashed − Border is a series of short lines.
•double − Border is two solid lines.
•groove − Border looks as though it is carved into the page.
Outline property in CSS
h1 {
outline:4px dashed green
}
The outline property specifies an entire line around the content. The line is placed outside
the border of the web page to make web page more attractive.
Margin property in CSS
h1 {
margin-top:50px
}
p {
margin:50px
}
The margin properties are used in css to provide space around the elements, outside of any specified borders. The different
margins are -
•margin-top
•margin-bottom
•margin-right
•margin-left
•margin
Float property in CSS
h1 {
outline:4px dashed green
}
The float property is used to wrap text around images. It is mainly used to position and format content around
images. The float property can have the following values:
•left
•right
•none
•inherit
CSS can be included in HTML File in three different ways:
1. Write CSS in HTML File
2. Write CSS in Separate Files
3. Inline Styles
Write CSS in HTML File
<head>
<style>
h1 {
color: blue;
}
</style>
</head>
CSS code can be written in an HTML file by enclosing the code in <style> tags. Code surrounded
by <style> tags will be interpreted as CSS syntax.
Write CSS in Separate Files
<head>
<link href="style.css" type="text/css" rel="stylesheet">
</head>
CSS code can be written in its own files to keep it separate from the HTML code. The
extension for CSS files is .css. These can be linked to an HTML file using a <link> tag in
the <head> section.
Inline Styles
<h2 style="text-align: center;">Centered text</h2>
<p style="color: blue; font-size: 18px;">Blue, 18-point text</p>
CSS styles can be directly added to HTML elements by using the style attribute in the
element’s opening tag. Each style declaration is ended with a semicolon. Styles added in
this manner are known as inline styles.
Presentation by Vineeta Singh

More Related Content

Similar to CSS Presentation Notes.pptx

Similar to CSS Presentation Notes.pptx (20)

Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designers
 
05. session 05 introducing css
05. session 05   introducing css05. session 05   introducing css
05. session 05 introducing css
 
Web day01 MOL.pdf
Web day01 MOL.pdfWeb day01 MOL.pdf
Web day01 MOL.pdf
 
Cordova training - Day 2 Introduction to CSS 3
Cordova training - Day 2 Introduction to CSS 3Cordova training - Day 2 Introduction to CSS 3
Cordova training - Day 2 Introduction to CSS 3
 
Css
CssCss
Css
 
WT CSS
WT  CSSWT  CSS
WT CSS
 
Css Intro by
Css Intro by Css Intro by
Css Intro by
 
Cascading style sheet
Cascading style sheetCascading style sheet
Cascading style sheet
 
Css
CssCss
Css
 
Css basics
Css basicsCss basics
Css basics
 
Introduction to css & its attributes with syntax
Introduction to css & its attributes with syntaxIntroduction to css & its attributes with syntax
Introduction to css & its attributes with syntax
 
Introduction to CSS3
Introduction to CSS3Introduction to CSS3
Introduction to CSS3
 
Css
CssCss
Css
 
css1.ppt
css1.pptcss1.ppt
css1.ppt
 
waxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.ppt
waxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.pptwaxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.ppt
waxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.ppt
 
CSS: How To Learn Easily
CSS: How To Learn EasilyCSS: How To Learn Easily
CSS: How To Learn Easily
 
Chapter 3 - CSS.pdf
Chapter 3 - CSS.pdfChapter 3 - CSS.pdf
Chapter 3 - CSS.pdf
 
Web - CSS 1.pptx
Web - CSS 1.pptxWeb - CSS 1.pptx
Web - CSS 1.pptx
 
CSS - Basics
CSS - BasicsCSS - Basics
CSS - Basics
 
Lecture-6.pptx
Lecture-6.pptxLecture-6.pptx
Lecture-6.pptx
 

Recently uploaded

Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxsqpmdrvczh
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayMakMakNepo
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 

Recently uploaded (20)

Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up Friday
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 

CSS Presentation Notes.pptx

  • 1. CSS CSS stands for Cascading Style Sheets It is the language for describing the presentation of Web pages, including colours, layout, and fonts, thus making our web pages presentable to the users.
  • 2. Purpose of CSS CSS, or Cascading Style Sheets, is a language that is used in combination with HTML that customizes how HTML elements will appear. CSS can define styles and change the layout and design of a sheet. Separating HTML code from CSS code It is common practice to separate content code in HTML files from styling code in CSS files. This can help make the code easier to maintain, by keeping the syntax for each file
  • 3. CSS declarations /* CSS declaration format: property-name: value; */ /* CSS declarations */ text-align: center; color: purple; width: 100px; In CSS, a declaration is the key-value pair of a CSS property and its value. CSS declarations are used to set style properties and construct rules to apply to individual or groups of elements. The property name and value are separated by a colon, and the entire declaration must be terminated by a semi-colon.
  • 4. CSS Rule Sets h1 { color: blue; text-align: center; } A CSS rule set contains one or more selectors and one or more declarations. The selector(s), which in this example is h1, points to an HTML element. The declaration(s), which in this example are color: blue and text-align: center style the element with a property and value. The rule set is the main building block of a CSS sheet.
  • 5. Background Color background-color: cyan; The background-color CSS property controls the background color of elements. Background Image background-image: url("images/tiger.gif"); The background-image CSS property sets the background image of an element. An image URL should be provided in the syntax url(“images/tiger.jpg") as the value of the property.
  • 6.
  • 7.
  • 8. Font Family h2 { font-family: Verdana; } p { font-family: "Courier New"; } The font-family CSS property is used to specify the typeface in a rule set. Fonts must be available to the browser to display correctly, either on the computer or linked as a web font. If a font value is not available, browsers will display their default font. When using a multi-word font name, it is best practice to wrap them in quotes. Font Size font-size: 30px; The font-size CSS property is used to set text sizes. Font size values can be many different units or types such as pixels.
  • 9.
  • 10. Font Weight font-weight: bold; The font-weight CSS property can be used to set the weight (boldness) of text. The provided value can be a keyword such as bold /normal/inherit. Text Align text-align: right; The text-align CSS property can be used to set the text alignment of inline contents. This property can be set to these values: left, right, or center.
  • 11. Setting foreground text color in CSS p { color : #2a2aff ; } Using the color property, foreground text color of an element can be set in CSS. Color Name Keywords h1 { color: aqua; } li { color: khaki; } Color name keywords can be used to set color property values for elements in CSS.
  • 12.
  • 13. Setting border in CSS h1 { border:2px solid yellow } The border properties allow you to specify how the border of the box representing an element should look. The border-style property allows you to select one of the following styles of border − •solid − Border is a single solid line. •dotted − Border is a series of dots. •dashed − Border is a series of short lines. •double − Border is two solid lines. •groove − Border looks as though it is carved into the page.
  • 14.
  • 15. Outline property in CSS h1 { outline:4px dashed green } The outline property specifies an entire line around the content. The line is placed outside the border of the web page to make web page more attractive.
  • 16.
  • 17. Margin property in CSS h1 { margin-top:50px } p { margin:50px } The margin properties are used in css to provide space around the elements, outside of any specified borders. The different margins are - •margin-top •margin-bottom •margin-right •margin-left •margin
  • 18.
  • 19. Float property in CSS h1 { outline:4px dashed green } The float property is used to wrap text around images. It is mainly used to position and format content around images. The float property can have the following values: •left •right •none •inherit
  • 20.
  • 21.
  • 22. CSS can be included in HTML File in three different ways: 1. Write CSS in HTML File 2. Write CSS in Separate Files 3. Inline Styles
  • 23. Write CSS in HTML File <head> <style> h1 { color: blue; } </style> </head> CSS code can be written in an HTML file by enclosing the code in <style> tags. Code surrounded by <style> tags will be interpreted as CSS syntax.
  • 24. Write CSS in Separate Files <head> <link href="style.css" type="text/css" rel="stylesheet"> </head> CSS code can be written in its own files to keep it separate from the HTML code. The extension for CSS files is .css. These can be linked to an HTML file using a <link> tag in the <head> section.
  • 25. Inline Styles <h2 style="text-align: center;">Centered text</h2> <p style="color: blue; font-size: 18px;">Blue, 18-point text</p> CSS styles can be directly added to HTML elements by using the style attribute in the element’s opening tag. Each style declaration is ended with a semicolon. Styles added in this manner are known as inline styles.