SlideShare uma empresa Scribd logo
1 de 16
JavaScript and CSS in
    HTML5 Web
    Development
   HTML5 Multimedia Developer’s Guide
             Chapter Two
              (Part Two)
Overview of CSS
Cascading Style Sheets (CSS) make Web
more manageable and design-friendly
Incorporated into Web page in 3 ways:
  From external CSS file
  From block of style instructions in
  <head>
  In-line as attribute of HTML tag
Why is it Cascading?
Priority of how 3 methods of CSS are used cascade
   Styling set on a tag overrides style found in
   head
   Styling found in head overrides style from
   external CSS file
   BUT: if CSS file is linked after styling in head,
   external file overrides styling found in head
So how does it work?
CSS works through system of selectors
  Selectors are identifiers that match page
  elements
Each selector has 1 or more declarations
  Declaration consists of a property and a
  value
An Example

p {border-style:solid;}
  Paragraph element (p) is selector
  border-style:solid is declaration
    Gives value solid to property
    border-style
Try this code:
<!doctype html>
<html lang=”en”>
   <head>
       <title>CSS Example 1</title>
   </head>
   <body>
       <p>I am text within a paragraph tag</p>
       I am another paragraph, but I do not sit in a
       paragraph tag. Therefore, I am not affected by
       CSS applied to paragraph tags.
       <p>I am another paragraph. My border is kinda
       neat, don’t ya think?</p>
   </body>
</html>
Now this...
<!doctype html>
<html lang=”en”>
     <head>
         <title>CSS Example 2</title>
         <style>
              p {border-style:solid;
                  padding:10px;
                  width:500px;}
         </style>
     </head>
     <body>
         <p>I am text within a paragraph tag</p>
         I am another paragraph, but I do not sit in a paragraph tag.
         Therefore, I am not affected by CSS applied to paragraph tags.
         <p>I am another paragraph. My border is kinda neat, don’t ya
         think?</p>
     </body>
</html>
Let’s look at cascading
<!doctype html>
<html lang=”en”>
     <head>
         <title>CSS Example 3</title>
         <link rel=”stylesheet” href=”style.css” type=”text/css” />
         <style>
              p {border-style:solid;padding:10px;width:500px;}
         </style>
     </head>
     <body>
         <p>I am text within a paragraph tag</p>
         I am another paragraph, but I do not sit in a paragraph tag.
         Therefore, I am not affected by CSS applied to paragraph tags.
         <p style=”font-style:normal;”>I am another paragraph. My border is
         kinda neat, don’t ya think?</p>
         <p style=”border-style:none;font-size:1em”>I am a paragraph, but
         (sigh) no border and small text</p>
     </body>
</html>
The style.css file

/*
This is a CSS external file
*/
p {
   font-size:2em;
   font-style:italic;
   }
ID Selectors
CSS can be applied to all visible HTML
tags
Can also target specific page areas using
identifiers
  Identifiers are set using the id attribute of
  the element. For example:
     <div id=”header”>
Playing With Identifiers



Type the code in Code Listings 2-7 and 2-8
CSS Classes vs. Identifiers

Identifiers apply CSS to one, unique page
element
Classes used to apply the same CSS to
multiple tags
Note: identifiers (in CSS) start with #.
Classes start with a period (.)
For Example...
.articletitle1 {font-
size:1.4em;}
.spacer1 (height:4px;}
Any page element with class of articletitle1
has a large font size
Any page element with class of spacer1 will
be 4px high
An Important Note


The # for identifiers and . for classes is used
only in CSS
When you set the id or class attribute, you
leave off the # or .
CSS and HTML5 Tags

How does CSS work with the new HTML5
tags?
  The same way!
  The new HTML5 tags are true HTML
  tags, so they’re treated the same as any
  other HTML tags.
Styling the Audio Tag
By default, the audio tag has little visual
impact
   Tag plays audio, and is aimed to and for
   the ears, not the eyes
Since it’s a native HTML5 tag, we can style
it
Code Listing 2-10

Mais conteúdo relacionado

Mais procurados (19)

Css introduction
Css   introductionCss   introduction
Css introduction
 
Web programming css
Web programming cssWeb programming css
Web programming css
 
CSS - Cascading Style Sheet
CSS - Cascading Style SheetCSS - Cascading Style Sheet
CSS - Cascading Style Sheet
 
CSS- Cascading Style Sheet
CSS- Cascading Style SheetCSS- Cascading Style Sheet
CSS- Cascading Style Sheet
 
CSS introduction
CSS introductionCSS introduction
CSS introduction
 
CSS Introduction
CSS IntroductionCSS Introduction
CSS Introduction
 
HTML and CSS
HTML and CSSHTML and CSS
HTML and CSS
 
HTML- Hyper Text Markup Language
HTML- Hyper Text Markup LanguageHTML- Hyper Text Markup Language
HTML- Hyper Text Markup Language
 
Cascading Style Sheets
Cascading Style SheetsCascading Style Sheets
Cascading Style Sheets
 
Introduction to css & its attributes with syntax
Introduction to css & its attributes with syntaxIntroduction to css & its attributes with syntax
Introduction to css & its attributes with syntax
 
Casc Style Sheets Ii
Casc Style Sheets IiCasc Style Sheets Ii
Casc Style Sheets Ii
 
Cascading style sheets (CSS)
Cascading style sheets (CSS)Cascading style sheets (CSS)
Cascading style sheets (CSS)
 
Web Design Assignment 1
Web Design Assignment 1 Web Design Assignment 1
Web Design Assignment 1
 
CSS Basics - Stylesheets and Color
CSS Basics - Stylesheets and ColorCSS Basics - Stylesheets and Color
CSS Basics - Stylesheets and Color
 
CSS
CSSCSS
CSS
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
Cascading Style Sheet
Cascading Style SheetCascading Style Sheet
Cascading Style Sheet
 
Week3 css
Week3 cssWeek3 css
Week3 css
 
Week 12 CSS - Review from last week
Week 12 CSS - Review from last weekWeek 12 CSS - Review from last week
Week 12 CSS - Review from last week
 

Destaque

Castro Chapter 7
Castro Chapter 7Castro Chapter 7
Castro Chapter 7Jeff Byrnes
 
Castro Chapter 3
Castro Chapter 3Castro Chapter 3
Castro Chapter 3Jeff Byrnes
 
Financial analysis pp
Financial analysis ppFinancial analysis pp
Financial analysis ppJoeVelarde
 
Castro Chapter 4
Castro Chapter 4Castro Chapter 4
Castro Chapter 4Jeff Byrnes
 
Castro Chapter 5
Castro Chapter 5Castro Chapter 5
Castro Chapter 5Jeff Byrnes
 
Castro Chapter 6
Castro Chapter 6Castro Chapter 6
Castro Chapter 6Jeff Byrnes
 
Castro Chapter 15
Castro Chapter 15Castro Chapter 15
Castro Chapter 15Jeff Byrnes
 
INFO 3775 Chapter 2 Part 1
INFO 3775 Chapter 2 Part 1INFO 3775 Chapter 2 Part 1
INFO 3775 Chapter 2 Part 1Jeff Byrnes
 

Destaque (8)

Castro Chapter 7
Castro Chapter 7Castro Chapter 7
Castro Chapter 7
 
Castro Chapter 3
Castro Chapter 3Castro Chapter 3
Castro Chapter 3
 
Financial analysis pp
Financial analysis ppFinancial analysis pp
Financial analysis pp
 
Castro Chapter 4
Castro Chapter 4Castro Chapter 4
Castro Chapter 4
 
Castro Chapter 5
Castro Chapter 5Castro Chapter 5
Castro Chapter 5
 
Castro Chapter 6
Castro Chapter 6Castro Chapter 6
Castro Chapter 6
 
Castro Chapter 15
Castro Chapter 15Castro Chapter 15
Castro Chapter 15
 
INFO 3775 Chapter 2 Part 1
INFO 3775 Chapter 2 Part 1INFO 3775 Chapter 2 Part 1
INFO 3775 Chapter 2 Part 1
 

Semelhante a INFO3775 Chapter 2 Part 2 (20)

Css
CssCss
Css
 
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
 
Html Styles-CSS
Html Styles-CSSHtml Styles-CSS
Html Styles-CSS
 
INTRODUCTIONS OF CSS
INTRODUCTIONS OF CSSINTRODUCTIONS OF CSS
INTRODUCTIONS OF CSS
 
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
 
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
 
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
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to css
 
Lecture-6.pptx
Lecture-6.pptxLecture-6.pptx
Lecture-6.pptx
 
Css
CssCss
Css
 
Css
CssCss
Css
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to css
 
CSS.pdf
CSS.pdfCSS.pdf
CSS.pdf
 
Cascstylesheets
CascstylesheetsCascstylesheets
Cascstylesheets
 
html-css
html-csshtml-css
html-css
 

Mais de Jeff Byrnes

Castro Chapter 11
Castro Chapter 11Castro Chapter 11
Castro Chapter 11Jeff Byrnes
 
Castro Chapter 10
Castro Chapter 10Castro Chapter 10
Castro Chapter 10Jeff Byrnes
 
Castro Chapter 9
Castro Chapter 9Castro Chapter 9
Castro Chapter 9Jeff Byrnes
 
Castro Chapter 8
Castro Chapter 8Castro Chapter 8
Castro Chapter 8Jeff Byrnes
 
Castro Chapter 2
Castro Chapter 2Castro Chapter 2
Castro Chapter 2Jeff Byrnes
 
Castro Chapter 2
Castro Chapter 2Castro Chapter 2
Castro Chapter 2Jeff Byrnes
 

Mais de Jeff Byrnes (6)

Castro Chapter 11
Castro Chapter 11Castro Chapter 11
Castro Chapter 11
 
Castro Chapter 10
Castro Chapter 10Castro Chapter 10
Castro Chapter 10
 
Castro Chapter 9
Castro Chapter 9Castro Chapter 9
Castro Chapter 9
 
Castro Chapter 8
Castro Chapter 8Castro Chapter 8
Castro Chapter 8
 
Castro Chapter 2
Castro Chapter 2Castro Chapter 2
Castro Chapter 2
 
Castro Chapter 2
Castro Chapter 2Castro Chapter 2
Castro Chapter 2
 

Último

Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxPoojaSen20
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 

Último (20)

Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 

INFO3775 Chapter 2 Part 2

  • 1. JavaScript and CSS in HTML5 Web Development HTML5 Multimedia Developer’s Guide Chapter Two (Part Two)
  • 2. Overview of CSS Cascading Style Sheets (CSS) make Web more manageable and design-friendly Incorporated into Web page in 3 ways: From external CSS file From block of style instructions in <head> In-line as attribute of HTML tag
  • 3. Why is it Cascading? Priority of how 3 methods of CSS are used cascade Styling set on a tag overrides style found in head Styling found in head overrides style from external CSS file BUT: if CSS file is linked after styling in head, external file overrides styling found in head
  • 4. So how does it work? CSS works through system of selectors Selectors are identifiers that match page elements Each selector has 1 or more declarations Declaration consists of a property and a value
  • 5. An Example p {border-style:solid;} Paragraph element (p) is selector border-style:solid is declaration Gives value solid to property border-style
  • 6. Try this code: <!doctype html> <html lang=”en”> <head> <title>CSS Example 1</title> </head> <body> <p>I am text within a paragraph tag</p> I am another paragraph, but I do not sit in a paragraph tag. Therefore, I am not affected by CSS applied to paragraph tags. <p>I am another paragraph. My border is kinda neat, don’t ya think?</p> </body> </html>
  • 7. Now this... <!doctype html> <html lang=”en”> <head> <title>CSS Example 2</title> <style> p {border-style:solid; padding:10px; width:500px;} </style> </head> <body> <p>I am text within a paragraph tag</p> I am another paragraph, but I do not sit in a paragraph tag. Therefore, I am not affected by CSS applied to paragraph tags. <p>I am another paragraph. My border is kinda neat, don’t ya think?</p> </body> </html>
  • 8. Let’s look at cascading <!doctype html> <html lang=”en”> <head> <title>CSS Example 3</title> <link rel=”stylesheet” href=”style.css” type=”text/css” /> <style> p {border-style:solid;padding:10px;width:500px;} </style> </head> <body> <p>I am text within a paragraph tag</p> I am another paragraph, but I do not sit in a paragraph tag. Therefore, I am not affected by CSS applied to paragraph tags. <p style=”font-style:normal;”>I am another paragraph. My border is kinda neat, don’t ya think?</p> <p style=”border-style:none;font-size:1em”>I am a paragraph, but (sigh) no border and small text</p> </body> </html>
  • 9. The style.css file /* This is a CSS external file */ p { font-size:2em; font-style:italic; }
  • 10. ID Selectors CSS can be applied to all visible HTML tags Can also target specific page areas using identifiers Identifiers are set using the id attribute of the element. For example: <div id=”header”>
  • 11. Playing With Identifiers Type the code in Code Listings 2-7 and 2-8
  • 12. CSS Classes vs. Identifiers Identifiers apply CSS to one, unique page element Classes used to apply the same CSS to multiple tags Note: identifiers (in CSS) start with #. Classes start with a period (.)
  • 13. For Example... .articletitle1 {font- size:1.4em;} .spacer1 (height:4px;} Any page element with class of articletitle1 has a large font size Any page element with class of spacer1 will be 4px high
  • 14. An Important Note The # for identifiers and . for classes is used only in CSS When you set the id or class attribute, you leave off the # or .
  • 15. CSS and HTML5 Tags How does CSS work with the new HTML5 tags? The same way! The new HTML5 tags are true HTML tags, so they’re treated the same as any other HTML tags.
  • 16. Styling the Audio Tag By default, the audio tag has little visual impact Tag plays audio, and is aimed to and for the ears, not the eyes Since it’s a native HTML5 tag, we can style it Code Listing 2-10