SlideShare une entreprise Scribd logo
1  sur  23
Télécharger pour lire hors ligne
INTRO	
  TO	
  CSS	
  
IAT100	
  Spring	
  2010	
  
	
  
Diliara	
  Nasirova	
  
1	
  
OUTLINE	
  
¢  Covered	
  in	
  this	
  lesson:	
  
—  Overview	
  
¢  What	
  is	
  CSS?	
  
¢  Why	
  to	
  use	
  CSS?	
  
—  Structure	
  
¢  CSS	
  Syntax	
  Introduction	
  
¢  Three	
  places	
  CSS	
  can	
  be	
  de=ined	
  
¢  CSS	
  Syntax	
  Speci=ics	
  
¢  Cascading	
  Inheritance	
  
—  Applied	
  
¢  CSS	
  Hands-­‐on	
  
	
  
2	
  
WHAT	
  IS	
  CSS?	
  
¢  Cascading	
  Style	
  Sheets	
  (CSS)	
  de=ines	
  the	
  way	
  website	
  
content	
  is	
  presented.	
  	
  
Visit http://www.csszengarden.com
3	
  
WHERE	
  THE	
  DEFINITION	
  “CASCADING”	
  COMES	
  
FROM?	
  
4	
  
WHERE	
  THE	
  DEFINITION	
  “CASCADING”	
  COMES	
  
FROM?	
  
	
  
*detailed	
  info	
  later	
  
5	
  
WHERE	
  THE	
  DEFINITION	
  “CASCADING”	
  COMES	
  
FROM?	
  
*detailed	
  info	
  later	
  
6	
  
WHY	
  CSS?	
  
¢  Separate	
  Content	
  from	
  Form	
  
<font	
  size=“14px”>	
  
My	
  First	
  Header	
  
</font>	
  
<font	
  size=“12px”	
  color=“red”	
  face=“Verdana”>	
  
My	
  information	
  1	
  goes	
  here.	
  
</font>	
  
<font	
  size=“14px”>	
  
My	
  Second	
  Header	
  
</font>	
  
<font	
  size=“12px”	
  color=“red”	
  face=“Verdana”>	
  
Different	
  information	
  goes	
  here.	
  
</font>	
  
The	
  old	
  way:	
  
7	
  
WHY	
  CSS?	
  CONTINUED.	
  
¢  Separate	
  Content	
  from	
  Form	
  
—  Content	
  
	
  
	
  
	
  
—  Form	
  or	
  Style	
  
<p	
  class=“header”>My	
  First	
  Header</p>	
  
<p	
  class=“info”>My	
  Information	
  1	
  goes	
  here</p>	
  
<p	
  class=“header”>My	
  Second	
  Header</p>	
  
<p	
  class=“info”>Different	
  	
  Information	
  goes	
  here</p>	
  
	
  	
  
(Speci=ic	
  markup	
  properties	
  like	
  Class	
  will	
  be	
  discussed	
  later).	
  
.header	
  {	
  font-­‐size:14px;}	
  
.info	
  { 	
  font-­‐family:	
  verdana;	
  
	
  font-­‐color:	
  blue;	
  
	
  font-­‐size:	
  12px;	
  	
  }	
   8	
  
WHAT	
  DOES	
  THIS	
  SEPARATION	
  GET	
  US?	
  
9	
  
WHAT	
  DOES	
  THIS	
  SEPARATION	
  GET	
  US?	
  
10	
  
WHAT	
  DOES	
  THIS	
  SEPARATION	
  GET	
  US?	
  
11	
  
THREE	
  CSS	
  DEFINITION	
  LOCATIONS	
  
¢  Inline:	
  	
  the	
  “style”	
  attribute	
  
	
  	
  
¢  Internal:	
  the	
  <style>	
  markup	
  tag	
  
	
  
	
  
¢  External:	
  the	
  .css	
  stylesheet	
  =ile	
  
<p>	
  Content	
  </p>	
  
<p	
  style=“font-­‐color:red;	
  font-­‐size:10px;”>	
  Content	
  </p>	
  
<html>	
  <head>	
  
	
  	
  	
  <style>	
  
	
  	
  	
  	
  	
  	
  	
  p	
  { 	
  background-­‐color:	
  Red;	
  
	
  font-­‐family:	
  serif;	
  
	
  font-­‐color:	
  White;	
  }	
  
	
  	
  	
  </style>	
  
</head>	
  <body><p>Content</p></body>	
  </html>	
  
<link	
  rel="stylesheet"	
  type="text/css"	
  href=“mystylesheet.css"	
  />	
  
12	
  
CASCADING	
  
13	
  
CSS	
  SYNTAX	
  
¢  3	
  Elements	
  to	
  a	
  CSS	
  Statement	
  
—  Selector	
  
¢  What	
  HTML	
  sections	
  does	
  it	
  affect?	
  
—  Property	
  
¢  What	
  attribute	
  of	
  that	
  HTML	
  section	
  will	
  be	
  affected?	
  
—  Value	
  
¢  What	
  change	
  will	
  be	
  made	
  to	
  that	
  attribute?	
  
14	
  
CSS	
  SYNTAX	
  
¢  Applying	
  a	
  style	
  to	
  Multiple	
  selectors	
  -­‐	
  separate	
  the	
  
selectors	
  with	
  a	
  comma	
  (,)	
  
	
   	
  	
  
¢  Applying	
  Multiple	
  properties	
  -­‐	
  split	
  each	
  declaration	
  
with	
  a	
  semi-­‐colon	
  (;)	
  	
  
	
   	
  	
  
h1	
  {	
  color:red;	
  font-­‐family:calibri}
h1,	
  h2,	
  h3,	
  h4,	
  h5,	
  h6	
  {	
  color:	
  red	
  }	
  
15	
  
CSS	
  SYNTAX:	
  SELECTORS	
  
¢  Think	
  of	
  …	
  
—  Web	
  Page	
  as	
  a	
  university	
  
—  Selectors	
  can	
  be	
  tags,	
  classes,	
  IDs.	
  Then:	
  
¢  Tags	
  as	
  students	
  
¢  Class	
  as	
  student’s	
  major	
  
¢  ID	
  as	
  student’s	
  ID	
  number	
  	
  
16	
  
CSS	
  SYNTAX:	
  SELECTORS	
  
¢  Tag	
  Selector	
  
¢  Class	
  Selector–	
  precede	
  the	
  class	
  with	
  a	
  dot(.)	
  
¢  ID	
  selector	
  precedes	
  with	
  a	
  "#"	
  symbol	
  
CSS: 	
  .myinfo	
  {	
  font-­‐size:	
  10px;	
  
	
  font-­‐color:	
  White;	
  }	
  
	
  
HTML:	
   	
  <p	
  class=“myinfo” >	
  Content</p>	
  
	
  <div	
  class=“myinfo”>	
  Other	
  content</div>	
  
CSS:	
   	
  #container{	
  font-­‐size:	
  10px;	
  
	
  	
  	
  	
  	
  	
  	
  font-­‐color:	
  White;	
  }	
  
HTML:	
  	
  	
  	
  	
  <div	
  id=“container”>	
  This	
  is	
  one	
  section	
  </div>	
  
CSS:	
   	
  p	
  {font-­‐size:	
  10px;}	
  
HTML: 	
  <p>Content</p>	
  
17	
  
EXTRA	
  HTML	
  TAGS:	
  DIVISION	
  AND	
  SPAN	
  
¢  Extra	
  Tags:	
  Div	
  and	
  Span	
  de=ine	
  sections	
  in	
  a	
  HTML	
  =ile	
  
¢  Div	
  tag	
  is	
  a	
  style	
  element	
  for	
  multiple	
  lines	
  
¢  Span	
  tag	
  is	
  a	
  style	
  element	
  for	
  one	
  line	
  (inline).	
  
¢  You	
  can	
  apply	
  CSS	
  to	
  Div	
  through	
  ID/Class	
  Selector;	
  	
  
<div	
  id	
  =	
  “container”>	
  	
  
	
  	
  	
  	
  <h1>	
  Content	
  goes	
  here	
  </h1>	
  
	
  	
  	
  	
  <p>	
  Content	
  goes	
  here	
  </p>	
  	
  
</div>	
  
<p>	
  Content	
  <span	
  class=“myinfo”>	
  goes	
  here	
  <span>	
  </p>	
  	
  
18	
  
CASCADING	
  INHERITANCE	
  
19	
  
CSS	
  APPLIED	
  
¢  Hands-­‐on	
  CSS	
  Tutorial	
  
¢  Techbyte:	
  http://www.sfu.ca/~tutor/cgi-­‐bin/
techbytes/Dreamweaver/dw2.html	
  
20	
  
PRESENTATION	
  NOTES	
  
¢  Page	
  3:	
  
—  Originally	
  HTML	
  was	
  used	
  to	
  change	
  the	
  appearance	
  of	
  websites,	
  so	
  that	
  HTML	
  
documents	
  eventually	
  turned	
  into	
  a	
  mixture	
  of	
  content	
  and	
  presentaRon.	
  This	
  
problem	
  was	
  solved	
  by	
  W3C	
  (World	
  Wide	
  Web	
  ConsorRum)	
  that	
  created	
  CSS,	
  
level	
  1	
  in	
  1996.	
  It	
  was	
  quickly	
  adopted	
  by	
  all	
  main	
  web	
  browsers.	
  In	
  1998	
  W3C	
  
developed	
  a	
  more	
  sophisRcated	
  and	
  accurate	
  CSS2	
  followed	
  by	
  a	
  minor	
  CSS2.1	
  
update	
  and	
  CSS3	
  is	
  currently	
  under	
  development.	
  CSS	
  is	
  usually	
  stored	
  in	
  
separate	
  .css	
  style	
  sheets	
  which	
  can	
  be	
  re-­‐used	
  for	
  all	
  your	
  web	
  pages.	
  	
  
—  Cascading	
  Style	
  Sheets	
  (CSS)	
  is	
  a	
  language	
  that	
  works	
  with	
  HTML	
  documents	
  for	
  
adding	
  visual	
  style	
  to	
  web	
  sites,	
  in	
  other	
  words	
  for	
  defining	
  the	
  way	
  content	
  is	
  
presented.	
  It	
  deals	
  with	
  colors,	
  fonts,	
  background	
  images,	
  posiRons,	
  width,	
  
height,	
  visibility	
  and	
  many	
  other	
  things.	
  
¢  Page	
  7:	
  
—  Content	
  is	
  the	
  text	
  and	
  images,	
  marked	
  up	
  to	
  define	
  regions	
  of	
  specific	
  types	
  
—  Form	
  defines	
  the	
  “style”	
  for	
  the	
  content	
  	
  
21	
  
PRESENTATION	
  NOTES	
  
¢  Page	
  9:	
  
—  Separate	
  Content	
  from	
  Form	
  
¢  Specify	
  the	
  style	
  once	
  for	
  every	
  instance	
  of	
  that	
  class.	
  
¢  Example:	
  	
  Specify	
  the	
  font	
  once	
  for	
  all	
  text	
  on	
  the	
  HTML	
  page	
  that	
  you	
  
have	
  idenRfied	
  as	
  a	
  “header”.	
  
¢  The	
  style	
  sheet	
  can	
  be	
  a	
  separate	
  file	
  which	
  all	
  HTML	
  pages	
  on	
  your	
  enRre	
  
site	
  can	
  link	
  to.	
  
¢  Only	
  have	
  to	
  specify	
  the	
  style	
  once	
  for	
  your	
  ENTIRE	
  SITE	
  
¢  Can	
  change	
  the	
  style	
  for	
  your	
  enRre	
  site	
  by	
  ediRng	
  only	
  ONE	
  FILE.	
  
¢  Page	
  12:	
  
—  Note,	
  the	
  selector	
  for	
  inline	
  CSS	
  is	
  the	
  tag	
  which	
  contains	
  the	
  style	
  aaribute.	
  	
  
22	
  
RESOURCES:	
  
¢  Notes:	
  	
  
www.tagbytag.org/tutorials/css-­‐beginner/what-­‐is-­‐css	
  
	
  
¢  Pictures:	
  
www.wise-­‐women.org/tutorials/csstut/	
  
	
  
	
  
23	
  

Contenu connexe

Tendances (18)

Css ms megha
Css ms meghaCss ms megha
Css ms megha
 
css-tutorial
css-tutorialcss-tutorial
css-tutorial
 
1 03 - CSS Introduction
1 03 - CSS Introduction1 03 - CSS Introduction
1 03 - CSS Introduction
 
CSS introduction
CSS introductionCSS introduction
CSS introduction
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to css
 
Introduction to CSS3
Introduction to CSS3Introduction to CSS3
Introduction to CSS3
 
Fundamental CSS3
Fundamental CSS3Fundamental CSS3
Fundamental CSS3
 
Css
CssCss
Css
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
 
Css3
Css3Css3
Css3
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
The Dark Arts of CSS
The Dark Arts of CSSThe Dark Arts of CSS
The Dark Arts of CSS
 
Css for Development
Css for DevelopmentCss for Development
Css for Development
 
David Weliver
David WeliverDavid Weliver
David Weliver
 
Cascading style sheet (css)]
Cascading style sheet (css)]Cascading style sheet (css)]
Cascading style sheet (css)]
 
Full
FullFull
Full
 
CSS3 Media Queries
CSS3 Media QueriesCSS3 Media Queries
CSS3 Media Queries
 

En vedette (20)

Introduction css
Introduction cssIntroduction css
Introduction css
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
Css = cascading style sheets
Css = cascading style sheetsCss = cascading style sheets
Css = cascading style sheets
 
Flyover Margate Qld
Flyover Margate QldFlyover Margate Qld
Flyover Margate Qld
 
3.2 introduction to css
3.2 introduction to css3.2 introduction to css
3.2 introduction to css
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to css
 
Css
CssCss
Css
 
Php
PhpPhp
Php
 
CSS: An Introduction
CSS: An IntroductionCSS: An Introduction
CSS: An Introduction
 
CSS Introduction
CSS IntroductionCSS Introduction
CSS Introduction
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
 
Floating
FloatingFloating
Floating
 
Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01
 
Css positioning
Css positioningCss positioning
Css positioning
 
1 css introduction
1 css introduction1 css introduction
1 css introduction
 
Css
CssCss
Css
 
Css floats
Css floatsCss floats
Css floats
 
CSS Layouting #4 : Float
CSS Layouting #4 : FloatCSS Layouting #4 : Float
CSS Layouting #4 : Float
 
Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)
 
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
 

Similaire à CSS Introduction

Similaire à CSS Introduction (20)

DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.ppt
 
DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.ppt
 
DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.ppt
 
DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.ppt
 
DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.ppt
 
Unit 2-CSS & Bootstrap.ppt
Unit 2-CSS & Bootstrap.pptUnit 2-CSS & Bootstrap.ppt
Unit 2-CSS & Bootstrap.ppt
 
Introduction to CSS in HTML.ppt
Introduction to CSS in HTML.pptIntroduction to CSS in HTML.ppt
Introduction to CSS in HTML.ppt
 
Css
CssCss
Css
 
Unit 3 (it workshop).pptx
Unit 3 (it workshop).pptxUnit 3 (it workshop).pptx
Unit 3 (it workshop).pptx
 
How to use CSS3 in WordPress - Sacramento
How to use CSS3 in WordPress - SacramentoHow to use CSS3 in WordPress - Sacramento
How to use CSS3 in WordPress - Sacramento
 
LIS3353 SP12 Week 13
LIS3353 SP12 Week 13LIS3353 SP12 Week 13
LIS3353 SP12 Week 13
 
INTRODUCTIONS OF CSS
INTRODUCTIONS OF CSSINTRODUCTIONS OF CSS
INTRODUCTIONS OF CSS
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to css
 
INFO3775 Chapter 2 Part 2
INFO3775 Chapter 2 Part 2INFO3775 Chapter 2 Part 2
INFO3775 Chapter 2 Part 2
 
IP - Lecture 6, 7 Chapter-3 (3).ppt
IP - Lecture 6, 7 Chapter-3 (3).pptIP - Lecture 6, 7 Chapter-3 (3).ppt
IP - Lecture 6, 7 Chapter-3 (3).ppt
 
html-css
html-csshtml-css
html-css
 
Rational HATS and CSS
Rational HATS and CSSRational HATS and CSS
Rational HATS and CSS
 
Web topic 15 1 basic css layout
Web topic 15 1  basic css layoutWeb topic 15 1  basic css layout
Web topic 15 1 basic css layout
 
Css basic
Css basicCss basic
Css basic
 
Upstate CSCI 450 WebDev Chapter 3
Upstate CSCI 450 WebDev Chapter 3Upstate CSCI 450 WebDev Chapter 3
Upstate CSCI 450 WebDev Chapter 3
 

Dernier

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 

Dernier (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

CSS Introduction

  • 1. INTRO  TO  CSS   IAT100  Spring  2010     Diliara  Nasirova   1  
  • 2. OUTLINE   ¢  Covered  in  this  lesson:   —  Overview   ¢  What  is  CSS?   ¢  Why  to  use  CSS?   —  Structure   ¢  CSS  Syntax  Introduction   ¢  Three  places  CSS  can  be  de=ined   ¢  CSS  Syntax  Speci=ics   ¢  Cascading  Inheritance   —  Applied   ¢  CSS  Hands-­‐on     2  
  • 3. WHAT  IS  CSS?   ¢  Cascading  Style  Sheets  (CSS)  de=ines  the  way  website   content  is  presented.     Visit http://www.csszengarden.com 3  
  • 4. WHERE  THE  DEFINITION  “CASCADING”  COMES   FROM?   4  
  • 5. WHERE  THE  DEFINITION  “CASCADING”  COMES   FROM?     *detailed  info  later   5  
  • 6. WHERE  THE  DEFINITION  “CASCADING”  COMES   FROM?   *detailed  info  later   6  
  • 7. WHY  CSS?   ¢  Separate  Content  from  Form   <font  size=“14px”>   My  First  Header   </font>   <font  size=“12px”  color=“red”  face=“Verdana”>   My  information  1  goes  here.   </font>   <font  size=“14px”>   My  Second  Header   </font>   <font  size=“12px”  color=“red”  face=“Verdana”>   Different  information  goes  here.   </font>   The  old  way:   7  
  • 8. WHY  CSS?  CONTINUED.   ¢  Separate  Content  from  Form   —  Content         —  Form  or  Style   <p  class=“header”>My  First  Header</p>   <p  class=“info”>My  Information  1  goes  here</p>   <p  class=“header”>My  Second  Header</p>   <p  class=“info”>Different    Information  goes  here</p>       (Speci=ic  markup  properties  like  Class  will  be  discussed  later).   .header  {  font-­‐size:14px;}   .info  {  font-­‐family:  verdana;    font-­‐color:  blue;    font-­‐size:  12px;    }   8  
  • 9. WHAT  DOES  THIS  SEPARATION  GET  US?   9  
  • 10. WHAT  DOES  THIS  SEPARATION  GET  US?   10  
  • 11. WHAT  DOES  THIS  SEPARATION  GET  US?   11  
  • 12. THREE  CSS  DEFINITION  LOCATIONS   ¢  Inline:    the  “style”  attribute       ¢  Internal:  the  <style>  markup  tag       ¢  External:  the  .css  stylesheet  =ile   <p>  Content  </p>   <p  style=“font-­‐color:red;  font-­‐size:10px;”>  Content  </p>   <html>  <head>        <style>                p  {  background-­‐color:  Red;    font-­‐family:  serif;    font-­‐color:  White;  }        </style>   </head>  <body><p>Content</p></body>  </html>   <link  rel="stylesheet"  type="text/css"  href=“mystylesheet.css"  />   12  
  • 14. CSS  SYNTAX   ¢  3  Elements  to  a  CSS  Statement   —  Selector   ¢  What  HTML  sections  does  it  affect?   —  Property   ¢  What  attribute  of  that  HTML  section  will  be  affected?   —  Value   ¢  What  change  will  be  made  to  that  attribute?   14  
  • 15. CSS  SYNTAX   ¢  Applying  a  style  to  Multiple  selectors  -­‐  separate  the   selectors  with  a  comma  (,)         ¢  Applying  Multiple  properties  -­‐  split  each  declaration   with  a  semi-­‐colon  (;)           h1  {  color:red;  font-­‐family:calibri} h1,  h2,  h3,  h4,  h5,  h6  {  color:  red  }   15  
  • 16. CSS  SYNTAX:  SELECTORS   ¢  Think  of  …   —  Web  Page  as  a  university   —  Selectors  can  be  tags,  classes,  IDs.  Then:   ¢  Tags  as  students   ¢  Class  as  student’s  major   ¢  ID  as  student’s  ID  number     16  
  • 17. CSS  SYNTAX:  SELECTORS   ¢  Tag  Selector   ¢  Class  Selector–  precede  the  class  with  a  dot(.)   ¢  ID  selector  precedes  with  a  "#"  symbol   CSS:  .myinfo  {  font-­‐size:  10px;    font-­‐color:  White;  }     HTML:    <p  class=“myinfo” >  Content</p>    <div  class=“myinfo”>  Other  content</div>   CSS:    #container{  font-­‐size:  10px;                font-­‐color:  White;  }   HTML:          <div  id=“container”>  This  is  one  section  </div>   CSS:    p  {font-­‐size:  10px;}   HTML:  <p>Content</p>   17  
  • 18. EXTRA  HTML  TAGS:  DIVISION  AND  SPAN   ¢  Extra  Tags:  Div  and  Span  de=ine  sections  in  a  HTML  =ile   ¢  Div  tag  is  a  style  element  for  multiple  lines   ¢  Span  tag  is  a  style  element  for  one  line  (inline).   ¢  You  can  apply  CSS  to  Div  through  ID/Class  Selector;     <div  id  =  “container”>            <h1>  Content  goes  here  </h1>          <p>  Content  goes  here  </p>     </div>   <p>  Content  <span  class=“myinfo”>  goes  here  <span>  </p>     18  
  • 20. CSS  APPLIED   ¢  Hands-­‐on  CSS  Tutorial   ¢  Techbyte:  http://www.sfu.ca/~tutor/cgi-­‐bin/ techbytes/Dreamweaver/dw2.html   20  
  • 21. PRESENTATION  NOTES   ¢  Page  3:   —  Originally  HTML  was  used  to  change  the  appearance  of  websites,  so  that  HTML   documents  eventually  turned  into  a  mixture  of  content  and  presentaRon.  This   problem  was  solved  by  W3C  (World  Wide  Web  ConsorRum)  that  created  CSS,   level  1  in  1996.  It  was  quickly  adopted  by  all  main  web  browsers.  In  1998  W3C   developed  a  more  sophisRcated  and  accurate  CSS2  followed  by  a  minor  CSS2.1   update  and  CSS3  is  currently  under  development.  CSS  is  usually  stored  in   separate  .css  style  sheets  which  can  be  re-­‐used  for  all  your  web  pages.     —  Cascading  Style  Sheets  (CSS)  is  a  language  that  works  with  HTML  documents  for   adding  visual  style  to  web  sites,  in  other  words  for  defining  the  way  content  is   presented.  It  deals  with  colors,  fonts,  background  images,  posiRons,  width,   height,  visibility  and  many  other  things.   ¢  Page  7:   —  Content  is  the  text  and  images,  marked  up  to  define  regions  of  specific  types   —  Form  defines  the  “style”  for  the  content     21  
  • 22. PRESENTATION  NOTES   ¢  Page  9:   —  Separate  Content  from  Form   ¢  Specify  the  style  once  for  every  instance  of  that  class.   ¢  Example:    Specify  the  font  once  for  all  text  on  the  HTML  page  that  you   have  idenRfied  as  a  “header”.   ¢  The  style  sheet  can  be  a  separate  file  which  all  HTML  pages  on  your  enRre   site  can  link  to.   ¢  Only  have  to  specify  the  style  once  for  your  ENTIRE  SITE   ¢  Can  change  the  style  for  your  enRre  site  by  ediRng  only  ONE  FILE.   ¢  Page  12:   —  Note,  the  selector  for  inline  CSS  is  the  tag  which  contains  the  style  aaribute.     22  
  • 23. RESOURCES:   ¢  Notes:     www.tagbytag.org/tutorials/css-­‐beginner/what-­‐is-­‐css     ¢  Pictures:   www.wise-­‐women.org/tutorials/csstut/       23