SlideShare a Scribd company logo
CSSCascading Style Sheets
What is CSS?
O CSS stands for Cascading Style Sheets
O CSS describes how HTML elements are to be
displayed on screen or on a web page.
O CSS is a style language that defines layout of HTML
documents. For example, CSS covers fonts, colours,
margins, lines, height, width, background images and
many other things.
O CSS files can help define font, size, colour, spacing,
border and location of HTML information on a web
page, and can also be used to create a continuous look
throughout multiple pages of a website.
By Hansa(Hansika)
Halai
Why css?
O Saves Your Time
O Saves Your Visitors Time(less loading time)
O Gives You Design Flexibility
O Easier to maintain and update
O Multiple Device Compatibility
By Hansa(Hansika)
Halai
How it works?
O Syntax:
property : value;
O Ex:
color: red;
What is important to remember is that both
properties and values are case-sensitive in
CSS. The property and value in each pair is
separated by a colon (:).
By Hansa(Hansika)
Halai
O CSS declaration blocks:
• 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.
• A CSS declaration always ends with a semicolon, and
declaration blocks are surrounded by curly braces.
O Syntax:
Selector{property : value;
property : value;
}
The selector points to the HTML element you want to style.
By Hansa(Hansika)
Halai
OEx : p {
color: red;
text-align: center;
}
By Hansa(Hansika)
Halai
CSS Selectors
O CSS selectors are used to "find" (or select) HTML
elements based on their element name, id, class
and attribute.
O The element Selector
• The element selector selects elements based on
the element name.
Ex:
You can select all <p> elements on a page like the
example on next slide..
By Hansa(Hansika)
Halai
By Hansa(Hansika)
Halai
O The id Selector
• The id selector uses the id attribute of an HTML
element to select a specific element.
• The id of an element should be 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.
• The style rule in example (next slide) will be applied
to the HTML element with id="para1“ and also
different with id=“para2”.
By Hansa(Hansika)
Halai
Note: An id name cannot start with a number! By Hansa(Hansika)
Halai
O The class selector selects elements with a specific
class attribute.
O To select elements with a specific class, write a period
(.) character, followed by the name of the class.(P
sector in example)
O You can also specify that only specific HTML elements
should be affected by a class.(h1 sector in example)
O You will see both method’s example on next slide..
By Hansa(Hansika)
Halai
Note: A class name cannot start with a number! By Hansa(Hansika)
Halai
O Grouping Selectors
• If you have elements with the same style definitions.
• It will be better to group the selectors, to minimize the
code.
• To group selectors, separate each selector with a
comma.
Instead of write like this, you can write in
this sorter way
By Hansa(Hansika)
Halai
By Hansa(Hansika)
Halai
O CSS Comments
• Comments are used to explain the code, and may
help when you edit the source code at a later date.
• Comments are ignored by browsers.
• A CSS comment starts with /* and ends with */.
Comments can also span multiple lines:
O Ex:
By Hansa(Hansika)
Halai
How to insert CSS?
O There are three ways of inserting a style sheet:
• External style sheet
• Internal style sheet
• Inline style
1. External Style Sheet:
• With an external style sheet, you just need to create
separate css file where you manage entire look of your
website.
• Each page must include a reference to the external style
sheet file inside the <link> element. The <link> element
goes inside the <head> section. By Hansa(Hansika)
Halai
O An external style sheet can be written in any text editor.
The file should not contain any html tags. The style
sheet file must be saved with a .css extension.
O Ex: This is how test.css file look
like
Output
By Hansa(Hansika)
Halai
2. Internal Style Sheet:
• An internal style sheet may be used if one single
page has a unique style.
• Internal styles are defined within the <style>
element, inside the <head> section of an HTML
page.
• The downside of using an internal stylesheet is that
changes to the internal stylesheet only effect the
page the code is inserted into.
By Hansa(Hansika)
Halai
By Hansa(Hansika)
Halai
3. Inline Styles:
• An inline style may be used to apply a unique style for
a single element.
• To use inline styles, add the style attribute to the
relevant element. The style attribute can contain any
CSS property.
• Ex:
By Hansa(Hansika)
Halai
Multiple Style Sheets
O If some properties have been defined for the same
selector (element) in different style sheets, the value
from the last read style sheet will be used.
O Ex:
• Assume that an external style sheet (mystyle.css)has the
following style for the <h1> element:
mystyle.css
h1{
color: navy;
}
By Hansa(Hansika)
Halai
By Hansa(Hansika)
Halai
Few examples:
By Hansa(Hansika)
Halai
By Hansa(Hansika)
Halai
What is CSS?

More Related Content

What's hot

Html5 and-css3-overview
Html5 and-css3-overviewHtml5 and-css3-overview
Html5 and-css3-overview
Jacob Nelson
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basics
Eliran Eliassy
 
Cascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) helpCascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) help
casestudyhelp
 
Intro to HTML & CSS
Intro to HTML & CSSIntro to HTML & CSS
Intro to HTML & CSS
Syed Sami
 
Flexbox and Grid Layout
Flexbox and Grid LayoutFlexbox and Grid Layout
Flexbox and Grid Layout
Rachel Andrew
 
LINKING IN HTML
LINKING IN HTMLLINKING IN HTML
LINKING IN HTML
Varsha Dubey
 
Css
CssCss
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
Amit Tyagi
 
(Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS (Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS
Dave Kelly
 
Html & Css presentation
Html  & Css presentation Html  & Css presentation
Html & Css presentation
joilrahat
 
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
IT Geeks
 
Dom
DomDom
Cascading style sheets (CSS)
Cascading style sheets (CSS)Cascading style sheets (CSS)
Cascading style sheets (CSS)
Harshita Yadav
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
Mario Hernandez
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
Himanshu Pathak
 
cascading style sheet ppt
cascading style sheet pptcascading style sheet ppt
cascading style sheet ppt
abhilashagupta
 
CSS framework By Palash
CSS framework By PalashCSS framework By Palash
CSS framework By Palash
PalashBajpai
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
Amit Tyagi
 
Css
CssCss
Cascading Style Sheet
Cascading Style SheetCascading Style Sheet
Cascading Style Sheet
vijayta
 

What's hot (20)

Html5 and-css3-overview
Html5 and-css3-overviewHtml5 and-css3-overview
Html5 and-css3-overview
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basics
 
Cascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) helpCascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) help
 
Intro to HTML & CSS
Intro to HTML & CSSIntro to HTML & CSS
Intro to HTML & CSS
 
Flexbox and Grid Layout
Flexbox and Grid LayoutFlexbox and Grid Layout
Flexbox and Grid Layout
 
LINKING IN HTML
LINKING IN HTMLLINKING IN HTML
LINKING IN HTML
 
Css
CssCss
Css
 
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
 
(Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS (Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS
 
Html & Css presentation
Html  & Css presentation Html  & Css presentation
Html & Css presentation
 
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
 
Dom
DomDom
Dom
 
Cascading style sheets (CSS)
Cascading style sheets (CSS)Cascading style sheets (CSS)
Cascading style sheets (CSS)
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
 
cascading style sheet ppt
cascading style sheet pptcascading style sheet ppt
cascading style sheet ppt
 
CSS framework By Palash
CSS framework By PalashCSS framework By Palash
CSS framework By Palash
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
Css
CssCss
Css
 
Cascading Style Sheet
Cascading Style SheetCascading Style Sheet
Cascading Style Sheet
 

Similar to What is CSS?

chitra
chitrachitra
chitra
sweet chitra
 
Css
CssCss
Css introduction
Css introductionCss introduction
Css introduction
Sridhar P
 
basic programming language AND HTML CSS JAVApdf
basic programming language AND HTML CSS JAVApdfbasic programming language AND HTML CSS JAVApdf
basic programming language AND HTML CSS JAVApdf
elayelily
 
WEB TECHNOLOGY Unit-2.pptx
WEB TECHNOLOGY Unit-2.pptxWEB TECHNOLOGY Unit-2.pptx
WEB TECHNOLOGY Unit-2.pptx
karthiksmart21
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
smithaps4
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
Erin M. Kidwell
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
smitha273566
 
Cascading style sheet an introduction
Cascading style sheet   an introductionCascading style sheet   an introduction
Cascading style sheet an introduction
Himanshu Pathak
 
CSS_Day_ONE (W3schools)
CSS_Day_ONE (W3schools)CSS_Day_ONE (W3schools)
CSS_Day_ONE (W3schools)
Rafi Haidari
 
CSS Introduction
CSS Introduction CSS Introduction
CSS Introduction
Thapar Institute
 
Css
CssCss
Css tutorial
Css tutorialCss tutorial
Css tutorial
vedaste
 
Workshop 2 Slides.pptx
Workshop 2 Slides.pptxWorkshop 2 Slides.pptx
Workshop 2 Slides.pptx
DaniyalSardar
 
HTML to CSS Basics Exer 2.pptx
HTML to CSS Basics Exer 2.pptxHTML to CSS Basics Exer 2.pptx
HTML to CSS Basics Exer 2.pptx
JJFajardo1
 
Unit 2 WT-CSS.pptx web technology project
Unit 2 WT-CSS.pptx web technology projectUnit 2 WT-CSS.pptx web technology project
Unit 2 WT-CSS.pptx web technology project
abhiramhatwar
 
Introduction of css
Introduction of cssIntroduction of css
Introduction of css
Dinesh Kumar
 
CSS tutorial chapter 1
CSS tutorial chapter 1CSS tutorial chapter 1
CSS tutorial chapter 1
jeweltutin
 
CSS Basics part One
CSS Basics part OneCSS Basics part One
CSS Basics part One
M Ashraful Islam Jewel
 
Css.html
Css.htmlCss.html

Similar to What is CSS? (20)

chitra
chitrachitra
chitra
 
Css
CssCss
Css
 
Css introduction
Css introductionCss introduction
Css introduction
 
basic programming language AND HTML CSS JAVApdf
basic programming language AND HTML CSS JAVApdfbasic programming language AND HTML CSS JAVApdf
basic programming language AND HTML CSS JAVApdf
 
WEB TECHNOLOGY Unit-2.pptx
WEB TECHNOLOGY Unit-2.pptxWEB TECHNOLOGY Unit-2.pptx
WEB TECHNOLOGY Unit-2.pptx
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
 
Cascading style sheet an introduction
Cascading style sheet   an introductionCascading style sheet   an introduction
Cascading style sheet an introduction
 
CSS_Day_ONE (W3schools)
CSS_Day_ONE (W3schools)CSS_Day_ONE (W3schools)
CSS_Day_ONE (W3schools)
 
CSS Introduction
CSS Introduction CSS Introduction
CSS Introduction
 
Css
CssCss
Css
 
Css tutorial
Css tutorialCss tutorial
Css tutorial
 
Workshop 2 Slides.pptx
Workshop 2 Slides.pptxWorkshop 2 Slides.pptx
Workshop 2 Slides.pptx
 
HTML to CSS Basics Exer 2.pptx
HTML to CSS Basics Exer 2.pptxHTML to CSS Basics Exer 2.pptx
HTML to CSS Basics Exer 2.pptx
 
Unit 2 WT-CSS.pptx web technology project
Unit 2 WT-CSS.pptx web technology projectUnit 2 WT-CSS.pptx web technology project
Unit 2 WT-CSS.pptx web technology project
 
Introduction of css
Introduction of cssIntroduction of css
Introduction of css
 
CSS tutorial chapter 1
CSS tutorial chapter 1CSS tutorial chapter 1
CSS tutorial chapter 1
 
CSS Basics part One
CSS Basics part OneCSS Basics part One
CSS Basics part One
 
Css.html
Css.htmlCss.html
Css.html
 

Recently uploaded

Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Diana Rendina
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
imrankhan141184
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
Wahiba Chair Training & Consulting
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
S. Raj Kumar
 

Recently uploaded (20)

Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
 

What is CSS?

  • 2. What is CSS? O CSS stands for Cascading Style Sheets O CSS describes how HTML elements are to be displayed on screen or on a web page. O CSS is a style language that defines layout of HTML documents. For example, CSS covers fonts, colours, margins, lines, height, width, background images and many other things. O CSS files can help define font, size, colour, spacing, border and location of HTML information on a web page, and can also be used to create a continuous look throughout multiple pages of a website. By Hansa(Hansika) Halai
  • 3. Why css? O Saves Your Time O Saves Your Visitors Time(less loading time) O Gives You Design Flexibility O Easier to maintain and update O Multiple Device Compatibility By Hansa(Hansika) Halai
  • 4. How it works? O Syntax: property : value; O Ex: color: red; What is important to remember is that both properties and values are case-sensitive in CSS. The property and value in each pair is separated by a colon (:). By Hansa(Hansika) Halai
  • 5. O CSS declaration blocks: • 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. • A CSS declaration always ends with a semicolon, and declaration blocks are surrounded by curly braces. O Syntax: Selector{property : value; property : value; } The selector points to the HTML element you want to style. By Hansa(Hansika) Halai
  • 6. OEx : p { color: red; text-align: center; } By Hansa(Hansika) Halai
  • 7. CSS Selectors O CSS selectors are used to "find" (or select) HTML elements based on their element name, id, class and attribute. O The element Selector • The element selector selects elements based on the element name. Ex: You can select all <p> elements on a page like the example on next slide.. By Hansa(Hansika) Halai
  • 9. O The id Selector • The id selector uses the id attribute of an HTML element to select a specific element. • The id of an element should be 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. • The style rule in example (next slide) will be applied to the HTML element with id="para1“ and also different with id=“para2”. By Hansa(Hansika) Halai
  • 10. Note: An id name cannot start with a number! By Hansa(Hansika) Halai
  • 11. O The class selector selects elements with a specific class attribute. O To select elements with a specific class, write a period (.) character, followed by the name of the class.(P sector in example) O You can also specify that only specific HTML elements should be affected by a class.(h1 sector in example) O You will see both method’s example on next slide.. By Hansa(Hansika) Halai
  • 12. Note: A class name cannot start with a number! By Hansa(Hansika) Halai
  • 13. O Grouping Selectors • If you have elements with the same style definitions. • It will be better to group the selectors, to minimize the code. • To group selectors, separate each selector with a comma. Instead of write like this, you can write in this sorter way By Hansa(Hansika) Halai
  • 15. O CSS Comments • Comments are used to explain the code, and may help when you edit the source code at a later date. • Comments are ignored by browsers. • A CSS comment starts with /* and ends with */. Comments can also span multiple lines: O Ex: By Hansa(Hansika) Halai
  • 16. How to insert CSS? O There are three ways of inserting a style sheet: • External style sheet • Internal style sheet • Inline style 1. External Style Sheet: • With an external style sheet, you just need to create separate css file where you manage entire look of your website. • Each page must include a reference to the external style sheet file inside the <link> element. The <link> element goes inside the <head> section. By Hansa(Hansika) Halai
  • 17. O An external style sheet can be written in any text editor. The file should not contain any html tags. The style sheet file must be saved with a .css extension. O Ex: This is how test.css file look like Output By Hansa(Hansika) Halai
  • 18. 2. Internal Style Sheet: • An internal style sheet may be used if one single page has a unique style. • Internal styles are defined within the <style> element, inside the <head> section of an HTML page. • The downside of using an internal stylesheet is that changes to the internal stylesheet only effect the page the code is inserted into. By Hansa(Hansika) Halai
  • 20. 3. Inline Styles: • An inline style may be used to apply a unique style for a single element. • To use inline styles, add the style attribute to the relevant element. The style attribute can contain any CSS property. • Ex: By Hansa(Hansika) Halai
  • 21. Multiple Style Sheets O If some properties have been defined for the same selector (element) in different style sheets, the value from the last read style sheet will be used. O Ex: • Assume that an external style sheet (mystyle.css)has the following style for the <h1> element: mystyle.css h1{ color: navy; } By Hansa(Hansika) Halai