SlideShare a Scribd company logo
CSS
DIV Tag in HTML
• The <div> tag defines a division or a section in an HTML document.
• The <div> tag is easily styled by using the class or id attribute.
• The HTML Content Division element (<div>) is the generic container for
flow content.
• It has no effect on the content or layout until styled in some way using
CSS)
Cascading style-sheets (CSS)
• Created by Hakon Lie of MIT in 1994
• Has become the W3C standard for controlling visual presentation of web
pages
• Cascading style-sheets are powerful mechanism to add style to web
document
• Enforce standards and uniformity
• Create dynamic effects
• Works by allowing you to specify rules
Advantages of CSS
• Saves time
• Easy to change
• Keep consistency
• Give you more control over layout
• Use styles with JavaScript
• Make it easy to create a common format for all the Web pages
Types of Style Sheets
• In-line styles
• Embedded/internal styles
• External style sheet
In-line Style Sheet
• Add styles to each tag within the HTML file
• Use it when you need to format just a single section in a web page
• Style attribute is used to add style
• Example
• <h1 style=“color:red; font-family: sans-sarif;” > This is my content </h1>
Internal Style Sheet
• A style is applied to the entire HTML file
• Use it when you need to modify all instances of particular element (e.g., h1) in a
web page
•This is define between head tag
Example
<style>
h1 {
color:red;
font-family:sans-serif;
}
</style>
OUTPUT
External Style Sheet
• An external style sheet is a text file containing the style definition
(declaration) having extension .css
• Use it when you need to control the style for an entire web site
• Steps to create external style sheet:-
• Open a new blank document in Notepad or Notepad++
• Type style declarations, For example: h1 {color:red; font-family:calibri;}
• Do not include <style> tags
• Save the document as filename.css
External Style Sheet
• Open an HTML file
• Between <head> and </head> add
<link href=URL rel=“relation_type” type=“link_type”>
• URL is the file.css
• Relation_type=“stylesheet”
• Link_type=“text/css”
• Save this file as .html
For example if .html and the .css file are in the same directory
<link href=file.css rel=“stylesheet” type=“text/css”>
Defining CSS Rule
A rule consists of
• A selector: element or elements the declaration applies to
• Declaration: how the elements referred to in the selector should be styled
• Property: which is the property of the selected element
• Value: which is a specification for this property
Using ID’s
° Use an id to distinguish something, like a paragraph, from the others in a
document
° The id selector is used to specify a style for a single, unique element
° For example:-
° CSS file:
° #id_name
{style attributes and values}
° HTML file
° <tag ID=id_name>
Using Classes
° HTML and XHTML require each id be unique– therefore an id value can
only be used once in a document
° You can mark a group of elements with a common identifier using the class
attribute
° To create a class
• tag.class_name {style attributes} or .class_name {style attributes}
° To apply a style
• <tag CLASS=class_name>
• <h1 CLASS=FirstHeader>Content goes here….</h1>
Difference between ID’s and Classes
° You can’t have more than one tag with the same ID value
° You can apply the same Class value to multiple document tags
° Use ID's for any elements that are simply used once on a page
° OR
° Only use classes to style websites, but, when you have to use an element in
JavaScript, use an identifier
HTML File CSS File
file.css
Page.html
OUTPUT
HTML File CSS File
file.css
Page.html
We can use more than one classes in one tag by using “space”
OUTPUT
CSS Font properties
° font-family
° font-size
° font-weight
° font-style
° font-variant
CSS Font properties
font-family:
° Specifies the typeface or family of font that should be used
Common values:
° Arial, Courier/Courier New, Georgia, Times/Times New Roman and
Verdana
Example:
h1{
font-family:arial
}
CSS Font properties
font-size:
° Specifies the size of a font
Common values:
° In pixels (12px,20px etc.)
° Absolut size (small, medium, lage, x-large etc.)
Example:
h1{
font-size:20px
}
CSS Font properties
font-weight:
° Specifies whether the font should be bold or normal
Common values:
° Normal, bold, bolder, lighter
° 100, 200, 300, 400, 500, 600, 700, 800, 900
Example:
h1{
font-weight : bold
}
CSS Font properties
font-style:
° Specifies whether the font should be normal, italic or oblique
Common values:
° Normal, italic, oblique
Example:
h1{
font-style : italic
}
CSS Font properties
font-variant:
° Specifies whether the font should be normal or small-caps (smaller version
of upper case)
Common values:
° Normal, small-caps
Example:
h1{
font-variant : small-caps}
CSS Text properties
° color
° text-align
° vertical-align
° text-decoration
° text-transform
° word-spacing
° letter-spacing
CSS Text properties
° color:
• specifies the color of the text
• P{color : green}
° text-align:
• horizontal alignment of the text
• Left, right, center or justify
° vertical-align:
• Vertical alignment of the text
• Sub, super, top, middle, bottom
CSS Text properties
° text-decoration:
• specifies the whether the text should be underline, overline,
line-through or blinking
° text-transform:
• text should be lowercase, uppercase or capitalized
° letter-spacing:
• Specifies the space between letters
• H1{letter-spacing:3px}
CSS Text properties
° word-spacing:
• Specifies the space between words
• H1{word-spacing:4px}
CSS Background properties
° background-color:
• Specifies the background color
° background-image:
• Specifies the background image
° background-repeat:
• Specifies whether the image should repeat or not
° background-position:
• Where an image should be positioned
CSS Border properties
° border-style (solid, dashed, doted, double etc.)
° border-color
° border-bottom (solid, dashed, doted, double etc.)
°Padding-left
°Padding-right
°Padding-top
°padding-bottom
CSS Padding properties
Styling “HYPERLINKS”
° color :
• Changes the color of the links
° background-color :
• Highlights the link, as if it had been highlighted with a
highlighter pen
° text-decoration :
• Underline, strike through, over-line, blink
Styling “HYPERLINKS”
° Pseudo-classes of links:
° Link:
• Styles for links in general
° Visited:
• Styles the links which are already visited
° Hover:
• Styles when some on hovering over a link
° Active:
• Styles the links when a links is being clicked

More Related Content

Similar to CSS INTRODUCTION SLIDES WITH HTML CODE.pdf (20)

PPTX
v5-introduction to html-css-210321161444.pptx
hannahroseline2
 
PPTX
Css types internal, external and inline (1)
Webtech Learning
 
PPT
Basic css
Gopinath Ambothi
 
PPTX
Lecture-6.pptx
vishal choudhary
 
PPTX
CSS
DivyaKS12
 
PPTX
2_css.pptx
VarunMM2
 
PPTX
2_css.pptx
VarunMM2
 
PDF
CSCADING style sheet. Internal external inline
Ranjeet Reddy
 
PDF
css-ppt.pdf
EktaDesai14
 
PPTX
Cascading Style Sheets for web browser.pptx
alvindalejoyosa1
 
PDF
Intro to HTML and CSS - Class 2 Slides
Heather Rock
 
PPTX
Unit 2 WT-CSS.pptx web technology project
abhiramhatwar
 
PDF
Web Typography
Shawn Calvert
 
PPT
CSS Training in Bangalore
rajkamal560066
 
PPTX
Cascading Styling Sheets(CSS) simple design language intended to transform th...
JebaRaj26
 
DOC
Css introduction
vishnu murthy
 
v5-introduction to html-css-210321161444.pptx
hannahroseline2
 
Css types internal, external and inline (1)
Webtech Learning
 
Basic css
Gopinath Ambothi
 
Lecture-6.pptx
vishal choudhary
 
2_css.pptx
VarunMM2
 
2_css.pptx
VarunMM2
 
CSCADING style sheet. Internal external inline
Ranjeet Reddy
 
css-ppt.pdf
EktaDesai14
 
Cascading Style Sheets for web browser.pptx
alvindalejoyosa1
 
Intro to HTML and CSS - Class 2 Slides
Heather Rock
 
Unit 2 WT-CSS.pptx web technology project
abhiramhatwar
 
Web Typography
Shawn Calvert
 
CSS Training in Bangalore
rajkamal560066
 
Cascading Styling Sheets(CSS) simple design language intended to transform th...
JebaRaj26
 
Css introduction
vishnu murthy
 

Recently uploaded (20)

PPTX
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PPTX
How to Set Maximum Difference Odoo 18 POS
Celine George
 
PDF
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
PPTX
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
PDF
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
PPTX
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
PPTX
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
PDF
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
PDF
Dimensions of Societal Planning in Commonism
StefanMz
 
PPT
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
PDF
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
PDF
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
PPTX
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
PPTX
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
PDF
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
PPTX
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PPTX
THE TAME BIRD AND THE FREE BIRD.pptxxxxx
MarcChristianNicolas
 
PDF
community health nursing question paper 2.pdf
Prince kumar
 
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
How to Set Maximum Difference Odoo 18 POS
Celine George
 
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
Dimensions of Societal Planning in Commonism
StefanMz
 
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
THE TAME BIRD AND THE FREE BIRD.pptxxxxx
MarcChristianNicolas
 
community health nursing question paper 2.pdf
Prince kumar
 
Ad

CSS INTRODUCTION SLIDES WITH HTML CODE.pdf

  • 1. CSS
  • 2. DIV Tag in HTML • The <div> tag defines a division or a section in an HTML document. • The <div> tag is easily styled by using the class or id attribute. • The HTML Content Division element (<div>) is the generic container for flow content. • It has no effect on the content or layout until styled in some way using CSS)
  • 3. Cascading style-sheets (CSS) • Created by Hakon Lie of MIT in 1994 • Has become the W3C standard for controlling visual presentation of web pages • Cascading style-sheets are powerful mechanism to add style to web document • Enforce standards and uniformity • Create dynamic effects • Works by allowing you to specify rules
  • 4. Advantages of CSS • Saves time • Easy to change • Keep consistency • Give you more control over layout • Use styles with JavaScript • Make it easy to create a common format for all the Web pages
  • 5. Types of Style Sheets • In-line styles • Embedded/internal styles • External style sheet
  • 6. In-line Style Sheet • Add styles to each tag within the HTML file • Use it when you need to format just a single section in a web page • Style attribute is used to add style • Example • <h1 style=“color:red; font-family: sans-sarif;” > This is my content </h1>
  • 7. Internal Style Sheet • A style is applied to the entire HTML file • Use it when you need to modify all instances of particular element (e.g., h1) in a web page •This is define between head tag Example <style> h1 { color:red; font-family:sans-serif; } </style>
  • 9. External Style Sheet • An external style sheet is a text file containing the style definition (declaration) having extension .css • Use it when you need to control the style for an entire web site • Steps to create external style sheet:- • Open a new blank document in Notepad or Notepad++ • Type style declarations, For example: h1 {color:red; font-family:calibri;} • Do not include <style> tags • Save the document as filename.css
  • 10. External Style Sheet • Open an HTML file • Between <head> and </head> add <link href=URL rel=“relation_type” type=“link_type”> • URL is the file.css • Relation_type=“stylesheet” • Link_type=“text/css” • Save this file as .html For example if .html and the .css file are in the same directory <link href=file.css rel=“stylesheet” type=“text/css”>
  • 11. Defining CSS Rule A rule consists of • A selector: element or elements the declaration applies to • Declaration: how the elements referred to in the selector should be styled • Property: which is the property of the selected element • Value: which is a specification for this property
  • 12. Using ID’s ° Use an id to distinguish something, like a paragraph, from the others in a document ° The id selector is used to specify a style for a single, unique element ° For example:- ° CSS file: ° #id_name {style attributes and values} ° HTML file ° <tag ID=id_name>
  • 13. Using Classes ° HTML and XHTML require each id be unique– therefore an id value can only be used once in a document ° You can mark a group of elements with a common identifier using the class attribute ° To create a class • tag.class_name {style attributes} or .class_name {style attributes} ° To apply a style • <tag CLASS=class_name> • <h1 CLASS=FirstHeader>Content goes here….</h1>
  • 14. Difference between ID’s and Classes ° You can’t have more than one tag with the same ID value ° You can apply the same Class value to multiple document tags ° Use ID's for any elements that are simply used once on a page ° OR ° Only use classes to style websites, but, when you have to use an element in JavaScript, use an identifier
  • 15. HTML File CSS File file.css Page.html
  • 17. HTML File CSS File file.css Page.html We can use more than one classes in one tag by using “space”
  • 19. CSS Font properties ° font-family ° font-size ° font-weight ° font-style ° font-variant
  • 20. CSS Font properties font-family: ° Specifies the typeface or family of font that should be used Common values: ° Arial, Courier/Courier New, Georgia, Times/Times New Roman and Verdana Example: h1{ font-family:arial }
  • 21. CSS Font properties font-size: ° Specifies the size of a font Common values: ° In pixels (12px,20px etc.) ° Absolut size (small, medium, lage, x-large etc.) Example: h1{ font-size:20px }
  • 22. CSS Font properties font-weight: ° Specifies whether the font should be bold or normal Common values: ° Normal, bold, bolder, lighter ° 100, 200, 300, 400, 500, 600, 700, 800, 900 Example: h1{ font-weight : bold }
  • 23. CSS Font properties font-style: ° Specifies whether the font should be normal, italic or oblique Common values: ° Normal, italic, oblique Example: h1{ font-style : italic }
  • 24. CSS Font properties font-variant: ° Specifies whether the font should be normal or small-caps (smaller version of upper case) Common values: ° Normal, small-caps Example: h1{ font-variant : small-caps}
  • 25. CSS Text properties ° color ° text-align ° vertical-align ° text-decoration ° text-transform ° word-spacing ° letter-spacing
  • 26. CSS Text properties ° color: • specifies the color of the text • P{color : green} ° text-align: • horizontal alignment of the text • Left, right, center or justify ° vertical-align: • Vertical alignment of the text • Sub, super, top, middle, bottom
  • 27. CSS Text properties ° text-decoration: • specifies the whether the text should be underline, overline, line-through or blinking ° text-transform: • text should be lowercase, uppercase or capitalized ° letter-spacing: • Specifies the space between letters • H1{letter-spacing:3px}
  • 28. CSS Text properties ° word-spacing: • Specifies the space between words • H1{word-spacing:4px}
  • 29. CSS Background properties ° background-color: • Specifies the background color ° background-image: • Specifies the background image ° background-repeat: • Specifies whether the image should repeat or not ° background-position: • Where an image should be positioned
  • 30. CSS Border properties ° border-style (solid, dashed, doted, double etc.) ° border-color ° border-bottom (solid, dashed, doted, double etc.) °Padding-left °Padding-right °Padding-top °padding-bottom CSS Padding properties
  • 31. Styling “HYPERLINKS” ° color : • Changes the color of the links ° background-color : • Highlights the link, as if it had been highlighted with a highlighter pen ° text-decoration : • Underline, strike through, over-line, blink
  • 32. Styling “HYPERLINKS” ° Pseudo-classes of links: ° Link: • Styles for links in general ° Visited: • Styles the links which are already visited ° Hover: • Styles when some on hovering over a link ° Active: • Styles the links when a links is being clicked