SlideShare a Scribd company logo
Introduction to CSS
Why CSS?
• CSS Provides Efficiency in Design and Updates
• CSS relatively easy to use
• Can give you more flexibility and control
• Faster loading pages
• Increased consistency
• Brings more sophistication to web design
• CSS is designed primarily to enable the separation
of document content from document presentation.
Why CSS? (continued)
• W3C standard, started in 1996
• Improves accessibility
– Tables not required for elegance
• Reduces the complexity of pages
– Which in turn has led to more sophistication…
• It’s open up the way for other technologies to be
built on and be supported by CSS. There are dozens,
and still growing.
• Example, “Bootstrap”, which is an open source
framework that combines CSS, HTML and Javascript
CSS Overview
• CSS (Cascading Style Sheets)
• CSS defines HTML display
• Styles were added to HTML 4.0 to solve a
problem
• External Style Sheets are stored in .css files
CSS Syntax
• Selectors
• Declaration
• Properties
• Values
Selectors
• A “selector” is an instruction in a CSS rule set
that tells the browser what elements to
‘select’ for styling.
• Here are some that we will look at:
– element Selector
– id Selector
– class Selector
– grouping Selectors
Element or Tag Selector
• This selector selects tags by tag or “element”
name.
• This selector must match one or more HTML
elements of the same name.
• Easiest to use
Element Selector
p {
text-align: center;
color: red;
}
HTML
<p>UAlbany is one of the SUNY
centers.</p>
ID Selector
• The ID selector as a unique identifier to an element.
• The id selector is used if you want to select a single,
unique element.
• CSS uses a hash or pound sign (#) to indicate it’s ID
• ID's are unique
– IDs in theory, are only supposed to be used once per
page
– In other words, a page would not be validate by W3C
standards.
• Anytime we see ID in the computer world, think
“unique”.
The id Selector
#text1 {
text-align: center;
color: green;
}
<h1 id="text1">Think Spring!</h1>
Class Selector
• This selector allows you to style content
irrespective of what tag you apply it to
• Classes are NOT unique
– Use same class on multiple elements.
– Use multiple classes on the same element.
The class Selector
.center {
text-align: center;
color: green;
}
<h1 class="center">Think Spring!</h1>
<p class="center">Think Spring!</p>
CSS Grouping
• When several selectors share the same declarations, they may be
grouped into a comma-separated list.
• Take this
h1 { font-family: sans-serif }
h2 { font-family: sans-serif }
h3 { font-family: sans-serif }
And, do this:
h1, h2, h3 { font-family: sans-serif }
CSS Comments
• As with other computer languages, CSS allows
for comments
• Comments remind you and tell fellow coders
what your CSS does
• Allows you to “flag” code for further review
• Indispensable for large website and
programming projects
CSS Comments
h1 { font-size: 24px; font-
weight: bold; border: 1px solid
black; color: pink; }
/* This will make all <h1>
headers big, bold, pink, and
inside of a thin black
rectangle! */
Ways to Insert CSS
• Externally
• Internally
• Inline styles (inside tags)
Inline Styles
• Insert CSS style right within the HTML tag that
you want to apply them too.
• Very quick
• However, difficult to maintain
• Use sparingly
<h1 style="color:blue;margin-
left:30px;">Think Spring!</h1>
Internal (or Embedded) CSS
• Placed right on top of the page that it will
affect
• As with DTDs, you can internally create a
stylesheet
• They are more convenient for small webpages
• Mixing content and style will cause your pages
to become unwieldy over time.
Internal CSS stylesheet
<html>
<head>
<style type="text/css">
p {color: white; }
body {background-color: black; }
</style>
</head>
<body>
<p>White text on a black background!</p>
</body>
</html>
External Stylesheet
• Why use an external stylesheet?
– It keeps your website design and content separate.
• CSS code is easier to reuse.
• Instead of typing the same CSS code on every web
page you have,
• Merely have many pages refer to a single CSS file
with the "link" tag.
• You can make massive alterations to your web
pages with just a few changes in a single CSS file
External CSS Stylesheet
In your .XSL file, you will link out using this
command:
<head>
<link rel="stylesheet" type="tex
t/css" href="mystyle.css“/>
</head>
Browsers and CSS3
To be
replaced by
project
“Spartan”

More Related Content

PPTX
Cascading Styling Sheets(CSS) simple design language intended to transform th...
JebaRaj26
 
PPT
CSS Training in Bangalore
rajkamal560066
 
PPT
Unit 2-CSS & Bootstrap.ppt
TusharTikia
 
PDF
The CSS Handbook
jackchenvlo
 
PPTX
Introduction to Wed System And Technologies (1).pptx
AmeerHamza183012
 
PPTX
Cascading Style Sheets for web browser.pptx
alvindalejoyosa1
 
PPTX
Web Development - Lecture 5
Syed Shahzaib Sohail
 
PPTX
cascading style sheet(css).pptx
SuhaibKhan62
 
Cascading Styling Sheets(CSS) simple design language intended to transform th...
JebaRaj26
 
CSS Training in Bangalore
rajkamal560066
 
Unit 2-CSS & Bootstrap.ppt
TusharTikia
 
The CSS Handbook
jackchenvlo
 
Introduction to Wed System And Technologies (1).pptx
AmeerHamza183012
 
Cascading Style Sheets for web browser.pptx
alvindalejoyosa1
 
Web Development - Lecture 5
Syed Shahzaib Sohail
 
cascading style sheet(css).pptx
SuhaibKhan62
 

Similar to Introduction to CSS.pptx web for web web (20)

PPTX
Lecture-6.pptx
vishal choudhary
 
PPTX
Cashcading stylesheets
reddivarihareesh
 
PPTX
CSS_Day_ONE (W3schools)
Rafi Haidari
 
PPTX
cascading style sheets- About cascading style sheets on the selectors
JayanthiM19
 
PPTX
uptu web technology unit 2 Css
Abhishek Kesharwani
 
PPTX
WEB TECHNOLOGY Unit-2.pptx
karthiksmart21
 
PDF
Intro to HTML and CSS - Class 2 Slides
Heather Rock
 
PPTX
INTRODUCTIONS OF CSS
SURYANARAYANBISWAL1
 
PPTX
Lecture 9 CSS part 1.pptxType Classification
ZahouAmel1
 
PPT
Css training tutorial css3 &amp; css4 essentials
QA TrainingHub
 
PPTX
Unit 2 WT-CSS.pptx web technology project
abhiramhatwar
 
PPTX
UNIT 3WOP fgfufhbuiibpvihbvpihivbhibvipuuvbiuvboi
utsavsd11
 
PPTX
chitra
sweet chitra
 
PPTX
Cascading style sheet, CSS Box model, Table in CSS
SherinRappai
 
PPT
CSS 101
dunclair
 
PDF
Css tutorial
vedaste
 
PDF
Css tutorial
Sohail Christoper
 
PDF
Css - Tutorial
adelaticleanu
 
Lecture-6.pptx
vishal choudhary
 
Cashcading stylesheets
reddivarihareesh
 
CSS_Day_ONE (W3schools)
Rafi Haidari
 
cascading style sheets- About cascading style sheets on the selectors
JayanthiM19
 
uptu web technology unit 2 Css
Abhishek Kesharwani
 
WEB TECHNOLOGY Unit-2.pptx
karthiksmart21
 
Intro to HTML and CSS - Class 2 Slides
Heather Rock
 
INTRODUCTIONS OF CSS
SURYANARAYANBISWAL1
 
Lecture 9 CSS part 1.pptxType Classification
ZahouAmel1
 
Css training tutorial css3 &amp; css4 essentials
QA TrainingHub
 
Unit 2 WT-CSS.pptx web technology project
abhiramhatwar
 
UNIT 3WOP fgfufhbuiibpvihbvpihivbhibvipuuvbiuvboi
utsavsd11
 
chitra
sweet chitra
 
Cascading style sheet, CSS Box model, Table in CSS
SherinRappai
 
CSS 101
dunclair
 
Css tutorial
vedaste
 
Css tutorial
Sohail Christoper
 
Css - Tutorial
adelaticleanu
 
Ad

More from compengwaelalahmar (20)

PPT
hne human computer of eork sicew das.ppt
compengwaelalahmar
 
PPT
bxe vary very signed computer se sad.ppt
compengwaelalahmar
 
PPT
week1 computer architecture and design for
compengwaelalahmar
 
PPTX
HTML-CSS.pptx computer architect design v
compengwaelalahmar
 
PPT
ITEC229_Chapter8_new.ppt computer architecture
compengwaelalahmar
 
PPTX
lec11_CSS.pptx web page description desi
compengwaelalahmar
 
PPTX
ilet109_2.pptx web designer web page for
compengwaelalahmar
 
PPTX
8.haft design web designer web for web w
compengwaelalahmar
 
PPTX
HTML 3 - Stiller for December design web
compengwaelalahmar
 
PPTX
HTML 1 - Girf desigcomp web design web g
compengwaelalahmar
 
PPTX
software architecturev2.pptx cop computr
compengwaelalahmar
 
PPT
lec01_intr architecture com computeo.ppt
compengwaelalahmar
 
PPTX
lecture-11-1590405846 computer architect
compengwaelalahmar
 
PPT
Compiler to compiler whatsypechecking.PPT
compengwaelalahmar
 
PPT
D-lr-parsing compiler how to compiler com
compengwaelalahmar
 
PPT
Camtasia Getting Started Guide how to design.ppt
compengwaelalahmar
 
PPT
LR_Parser compiler how to compiler lr1 ll1
compengwaelalahmar
 
PPT
lec00-outline.PPT cpp compiler how to cpp
compengwaelalahmar
 
PPT
A-overview.pptbb cpp introduction how cpp
compengwaelalahmar
 
PPT
CS540-2-lecture1.pptgvcxc increment cpp cpp
compengwaelalahmar
 
hne human computer of eork sicew das.ppt
compengwaelalahmar
 
bxe vary very signed computer se sad.ppt
compengwaelalahmar
 
week1 computer architecture and design for
compengwaelalahmar
 
HTML-CSS.pptx computer architect design v
compengwaelalahmar
 
ITEC229_Chapter8_new.ppt computer architecture
compengwaelalahmar
 
lec11_CSS.pptx web page description desi
compengwaelalahmar
 
ilet109_2.pptx web designer web page for
compengwaelalahmar
 
8.haft design web designer web for web w
compengwaelalahmar
 
HTML 3 - Stiller for December design web
compengwaelalahmar
 
HTML 1 - Girf desigcomp web design web g
compengwaelalahmar
 
software architecturev2.pptx cop computr
compengwaelalahmar
 
lec01_intr architecture com computeo.ppt
compengwaelalahmar
 
lecture-11-1590405846 computer architect
compengwaelalahmar
 
Compiler to compiler whatsypechecking.PPT
compengwaelalahmar
 
D-lr-parsing compiler how to compiler com
compengwaelalahmar
 
Camtasia Getting Started Guide how to design.ppt
compengwaelalahmar
 
LR_Parser compiler how to compiler lr1 ll1
compengwaelalahmar
 
lec00-outline.PPT cpp compiler how to cpp
compengwaelalahmar
 
A-overview.pptbb cpp introduction how cpp
compengwaelalahmar
 
CS540-2-lecture1.pptgvcxc increment cpp cpp
compengwaelalahmar
 
Ad

Recently uploaded (20)

PPTX
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
PPTX
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
Celine George
 
PDF
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
PPTX
Five Point Someone – Chetan Bhagat | Book Summary & Analysis by Bhupesh Kushwaha
Bhupesh Kushwaha
 
PDF
PG-BPSDMP 2 TAHUN 2025PG-BPSDMP 2 TAHUN 2025.pdf
AshifaRamadhani
 
PDF
UTS Health Student Promotional Representative_Position Description.pdf
Faculty of Health, University of Technology Sydney
 
PPTX
Autodock-for-Beginners by Rahul D Jawarkar.pptx
Rahul Jawarkar
 
PDF
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
PDF
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
PDF
The Picture of Dorian Gray summary and depiction
opaliyahemel
 
PDF
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
PPTX
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
PPTX
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
PPT
Python Programming Unit II Control Statements.ppt
CUO VEERANAN VEERANAN
 
PPTX
TEF & EA Bsc Nursing 5th sem.....BBBpptx
AneetaSharma15
 
PDF
RA 12028_ARAL_Orientation_Day-2-Sessions_v2.pdf
Seven De Los Reyes
 
PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
PPTX
CDH. pptx
AneetaSharma15
 
PPTX
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
PDF
Sunset Boulevard Student Revision Booklet
jpinnuck
 
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
Celine George
 
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
Five Point Someone – Chetan Bhagat | Book Summary & Analysis by Bhupesh Kushwaha
Bhupesh Kushwaha
 
PG-BPSDMP 2 TAHUN 2025PG-BPSDMP 2 TAHUN 2025.pdf
AshifaRamadhani
 
UTS Health Student Promotional Representative_Position Description.pdf
Faculty of Health, University of Technology Sydney
 
Autodock-for-Beginners by Rahul D Jawarkar.pptx
Rahul Jawarkar
 
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
The Picture of Dorian Gray summary and depiction
opaliyahemel
 
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
Python Programming Unit II Control Statements.ppt
CUO VEERANAN VEERANAN
 
TEF & EA Bsc Nursing 5th sem.....BBBpptx
AneetaSharma15
 
RA 12028_ARAL_Orientation_Day-2-Sessions_v2.pdf
Seven De Los Reyes
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
CDH. pptx
AneetaSharma15
 
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
Sunset Boulevard Student Revision Booklet
jpinnuck
 

Introduction to CSS.pptx web for web web

  • 2. Why CSS? • CSS Provides Efficiency in Design and Updates • CSS relatively easy to use • Can give you more flexibility and control • Faster loading pages • Increased consistency • Brings more sophistication to web design • CSS is designed primarily to enable the separation of document content from document presentation.
  • 3. Why CSS? (continued) • W3C standard, started in 1996 • Improves accessibility – Tables not required for elegance • Reduces the complexity of pages – Which in turn has led to more sophistication… • It’s open up the way for other technologies to be built on and be supported by CSS. There are dozens, and still growing. • Example, “Bootstrap”, which is an open source framework that combines CSS, HTML and Javascript
  • 4. CSS Overview • CSS (Cascading Style Sheets) • CSS defines HTML display • Styles were added to HTML 4.0 to solve a problem • External Style Sheets are stored in .css files
  • 5. CSS Syntax • Selectors • Declaration • Properties • Values
  • 6. Selectors • A “selector” is an instruction in a CSS rule set that tells the browser what elements to ‘select’ for styling. • Here are some that we will look at: – element Selector – id Selector – class Selector – grouping Selectors
  • 7. Element or Tag Selector • This selector selects tags by tag or “element” name. • This selector must match one or more HTML elements of the same name. • Easiest to use
  • 8. Element Selector p { text-align: center; color: red; } HTML <p>UAlbany is one of the SUNY centers.</p>
  • 9. ID Selector • The ID selector as a unique identifier to an element. • The id selector is used if you want to select a single, unique element. • CSS uses a hash or pound sign (#) to indicate it’s ID • ID's are unique – IDs in theory, are only supposed to be used once per page – In other words, a page would not be validate by W3C standards. • Anytime we see ID in the computer world, think “unique”.
  • 10. The id Selector #text1 { text-align: center; color: green; } <h1 id="text1">Think Spring!</h1>
  • 11. Class Selector • This selector allows you to style content irrespective of what tag you apply it to • Classes are NOT unique – Use same class on multiple elements. – Use multiple classes on the same element.
  • 12. The class Selector .center { text-align: center; color: green; } <h1 class="center">Think Spring!</h1> <p class="center">Think Spring!</p>
  • 13. CSS Grouping • When several selectors share the same declarations, they may be grouped into a comma-separated list. • Take this h1 { font-family: sans-serif } h2 { font-family: sans-serif } h3 { font-family: sans-serif } And, do this: h1, h2, h3 { font-family: sans-serif }
  • 14. CSS Comments • As with other computer languages, CSS allows for comments • Comments remind you and tell fellow coders what your CSS does • Allows you to “flag” code for further review • Indispensable for large website and programming projects
  • 15. CSS Comments h1 { font-size: 24px; font- weight: bold; border: 1px solid black; color: pink; } /* This will make all <h1> headers big, bold, pink, and inside of a thin black rectangle! */
  • 16. Ways to Insert CSS • Externally • Internally • Inline styles (inside tags)
  • 17. Inline Styles • Insert CSS style right within the HTML tag that you want to apply them too. • Very quick • However, difficult to maintain • Use sparingly <h1 style="color:blue;margin- left:30px;">Think Spring!</h1>
  • 18. Internal (or Embedded) CSS • Placed right on top of the page that it will affect • As with DTDs, you can internally create a stylesheet • They are more convenient for small webpages • Mixing content and style will cause your pages to become unwieldy over time.
  • 19. Internal CSS stylesheet <html> <head> <style type="text/css"> p {color: white; } body {background-color: black; } </style> </head> <body> <p>White text on a black background!</p> </body> </html>
  • 20. External Stylesheet • Why use an external stylesheet? – It keeps your website design and content separate. • CSS code is easier to reuse. • Instead of typing the same CSS code on every web page you have, • Merely have many pages refer to a single CSS file with the "link" tag. • You can make massive alterations to your web pages with just a few changes in a single CSS file
  • 21. External CSS Stylesheet In your .XSL file, you will link out using this command: <head> <link rel="stylesheet" type="tex t/css" href="mystyle.css“/> </head>
  • 22. Browsers and CSS3 To be replaced by project “Spartan”