SlideShare a Scribd company logo
Applying CSS Styles
to Webpages
Web Design with
HTML5 & CSS3
8th Edition
• Explain the importance of separating design from
content
• Describe Cascading Style Sheets (CSS)
• Define inline, embedded, and external styles and
their order of precedence
• Describe a CSS rule and its syntax
• Explain the difference between a selector,
property, and value
Chapter 4: Applying CSS Styles to Webpages 2
Objectives
• Create styles that use text and color properties
• Explain the difference between inline and block
content
• Describe the CSS box model and how to apply
margins, padding, and borders
• Create an external style sheet and link it to an
HTML page
Chapter 4: Applying CSS Styles to Webpages 3
Objectives (continued)
• Create styles that use padding, border, and
margin properties
• Float an image
• Create styles that use list properties
• Add comments to an external style sheet
• Validate a CSS file
Chapter 4: Applying CSS Styles to Webpages 4
Objectives (continued 1)
• Style – It is a rule that defines the appearance of
an element on a webpage
• Style sheet – It is the set of CSS style rules
• Style sheets provide a means to separate style
from content because it gives the flexibility to
redesign or rebrand a website
• A single CSS style sheet file containing the defined
styles can be attached to several webpages to
apply the styles to all the attached pages
Chapter 4: Applying CSS Styles to Webpages 5
Using Cascading Style Sheets
• Inline style – It is used to add a style to the start
tag for an element, such as a heading or
paragraph, using the style attribute
Chapter 4: Applying CSS Styles to Webpages 6
Inline Styles
• An embedded style sheet, also called an internal
style sheet, includes the style sheet within the
opening <head> and closing </head> tags of the
HTML document
Chapter 4: Applying CSS Styles to Webpages 7
Embedded Style Sheets
• An external style sheet – It is a CSS file that
contains all of the styles that can be applied to
more than one page in a website
• External style sheets are also called linked style
sheets
• An external style sheet is a text file with the .css
extension
• To apply an external style sheet, link it (or attach
it) to a webpage using a link in the head section of
the webpage
Chapter 4: Applying CSS Styles to Webpages 8
External Style Sheets
• External style sheet provides flexibility to quickly
change webpage formats because the styles used
in it are applied to every page linked to it
• Changing the look of an entire website is
sometimes called reskinning the website
Chapter 4: Applying CSS Styles to Webpages 9
External Style Sheets (continued)
• Style sheets are said to “cascade” because each
type of style has a specified level of precedence
(or priority) in relationship to the others
• CSS properties can be inherited from a parent
element through a principle called inheritance
• If a selector has more than one CSS rule,
specificity determines which CSS rule to apply
Chapter 4: Applying CSS Styles to Webpages 10
Style Sheet Precedence
• Each CSS rule consists of a selector and a
declaration
Chapter 4: Applying CSS Styles to Webpages 11
CSS Basics
• Selector – It is the part of the statement that
identifies what to style
• Any HTML5 element such as body, header, nav,
main, or footer may be a selector
• A selector may also be the value of an id or class
attribute
• The declaration defines the exact formatting of
the style
Chapter 4: Applying CSS Styles to Webpages 12
CSS Basics (continued)
• A declaration consists of a property and a value,
separated by a colon and followed by a semicolon
• The property identifies the style quality or
characteristic to apply, such as
– color (text color)
– background-color
– text-indent
– border-width
– font-style
Chapter 4: Applying CSS Styles to Webpages 13
CSS Basics (continued 1)
• For each property, the declaration includes a
related value that identifies the particular
property value to apply
Chapter 4: Applying CSS Styles to Webpages 14
CSS Basics (continued 2)
Chapter 4: Applying CSS Styles to Webpages 15
CSS Basics (continued 3)
Chapter 4: Applying CSS Styles to Webpages 16
CSS Text Properties
• Fallback values – They are the additional values
provided for the font-family property in case the
browser does not support the primary font
• CSS measures font sizes using many measurement
units, including pixels, points, and ems, and by
keyword or percentage
Chapter 4: Applying CSS Styles to Webpages 17
CSS Text Properties (continued)
Chapter 4: Applying CSS Styles to Webpages 18
CSS Text Properties (continued
1)
• HTML uses color names or codes to designate
color values
• Two types of color codes can be used with CSS:
– Hexadecimal
– RGB
• Hexadecimal values consist of a six-digit number
code that corresponds to RGB (Red, Green, Blue)
color values
Chapter 4: Applying CSS Styles to Webpages 19
CSS Colors
Chapter 4: Applying CSS Styles to Webpages 20
CSS Colors (continued)
• To use a color in a style rule declaration, use the
color value as the property value
• For example, to style a background color as gray
use, background-color: #808080;
• HTML elements are positioned on the webpage as
a block or as inline content
• A block element appears as a block because it
starts and ends with a new line, such as the main
element or a paragraph element
• Inline elements are displayed without line breaks
so they flow within the same line
• Inline content always appears within block
elements
Chapter 4: Applying CSS Styles to Webpages 21
Understanding Inline Elements
and Block Elements
• Each block element such as a header, nav, main,
and footer element is displayed in a browser as a
box with content
• The CSS box model describes content boxes on a
webpage
Chapter 4: Applying CSS Styles to Webpages 22
CSS Box Model
• Each content box can have margins, borders, and
padding
• The margin provides passive white space between
block elements or between the top or bottom of a
webpage
• The border separates the padding and the margin
of the block element
• Padding is the passive white space between the
content and the border of a block element
Chapter 4: Applying CSS Styles to Webpages 23
CSS Box Model (continued)
Chapter 4: Applying CSS Styles to Webpages 24
CSS Box Model (continued 1)
• A style rule begins with a selector, which specifies
the element to style
• A selector can be
– an HTML element name
– an id attribute value
– a class attribute value
• An id or a class selector is used to apply styles to
p elements
Chapter 4: Applying CSS Styles to Webpages 25
Selectors
• An id selector uses the id attribute value of an
HTML element to select a single element
• For example, to style the div id="container"
element, use #container as the selector
#container {
border: solid 2px;
}
Chapter 4: Applying CSS Styles to Webpages 26
Selectors (continued)
• A class selector is used to select elements that
include a certain class attribute
• For example, to style class="mobile", use .mobile
as the selector
.mobile {
font-size: 10pt;
}
Chapter 4: Applying CSS Styles to Webpages 27
Selectors (continued 1)
• A descendant selector is used to create style that
applies to an element contained within another
element
• For example, the following style rule sets the list-
style property to none for list items in an
unordered list included in the navigation area:
nav ul li {
list-style: none;
}
Chapter 4: Applying CSS Styles to Webpages 28
Selectors (continued 2)
Chapter 4: Applying CSS Styles to Webpages 29
To Create a CSS File and a Style
Rule for the Body Element
• After creating a CSS file, link it to all the webpages
that will use its styles
• Insert a link element on the HTML page within
the <head> and </head> tags
• The link element uses two attributes:
– rel
– href
• The rel attribute uses the stylesheet value to
indicate that the document is linked to a style
sheet
Chapter 4: Applying CSS Styles to Webpages 30
Linking an HTML Document to a
CSS File
• The href attribute value specifies the file path or
file name of the CSS file
• Following is an example of a link to a style sheet
named styles.css and stored in the css folder:
<link rel="stylesheet"
href="css/styles.css">
• The type="text/css" attribute and value is also
commonly used within a link element to
reference a CSS file
Chapter 4: Applying CSS Styles to Webpages 31
Linking an HTML Document to a
CSS File (continued)
• One way to align webpage content is to use the
text-align property, which applies to block
elements
• The text-align property can use left (the default),
center, right, or justify as its value
• For example, the following rule centers an h1
element:
h1 {
text-align: center;
}
Chapter 4: Applying CSS Styles to Webpages 32
Aligning Webpage Content
• To center all of the elements of a webpage using a
single style rule, set the left and right margins to
auto
• In addition, set the width to 80% so that the
elements do not span 100 percent of the browser
window
Chapter 4: Applying CSS Styles to Webpages 33
To Center Content
• The header section appears at the top of a
webpage and thus needs formatting that makes
the header contents stand out and attract visitors
to the page
• The nav section should be formatted differently
from the other structural elements as it should be
prominent and easy to find on the webpage
• The main section should be formatted using the
display property
Chapter 4: Applying CSS Styles to Webpages 34
Creating Style Rules for
Structural Elements
• To apply text and box model properties to the
main section and have them appear as intended,
the display property is used
• Create a style rule that formats the footer section
by defining the font size, text alignment, and top
margin of the footer element
Chapter 4: Applying CSS Styles to Webpages 35
Creating Style Rules for
Structural Elements (continued)
Chapter 4: Applying CSS Styles to Webpages 36
To Create a Style Rule for the
Header Element
Chapter 4: Applying CSS Styles to Webpages 37
To Create a Style Rule for the
Nav Element
Chapter 4: Applying CSS Styles to Webpages 38
To Create a Style Rule for the
Main Element
Chapter 4: Applying CSS Styles to Webpages 39
To Create a Style Rule for the
Footer Element
• Consider the following example:
<img class="equip"
src="images/equipment1.jpg" alt="Weight
Equipment" height="195" width="260">
– The img element displays the equipment1.jpg image
– The first attribute and value, class="equip",
assigns this element to the equip class
– Including the class="equip" attribute and value in
each img element helps format all the elements
assigned to the equip class with a single style rule
Chapter 4: Applying CSS Styles to Webpages 40
Creating Style Rules for Classes
• For example, the following style rule adds 20 pixels
of padding to the right side of elements in the
equip class:
.equip {
padding-right: 20px;
}
Chapter 4: Applying CSS Styles to Webpages 41
Creating Style Rules for Classes
(continued)
• To indicate a class name as a selector, include a
period (.) before the class name
• Float property – It positions an element to the
right or left of other elements
• Clear property – It removes the float effect from a
webpage
Chapter 4: Applying CSS Styles to Webpages 42
Creating Style Rules for Classes
(continued 1)
• The CSS list-style properties are used to control
the appearance of numbered and bulleted lists
• Lists marked with the <ul> and </ul> tags display a
solid bullet before each list item
• Lists marked with the <ol> and </ol> tags display
Arabic numerals (1, 2, 3, and so on) before the list
items
• For example,
ul {
list-style-type: square;
}
Chapter 4: Applying CSS Styles to Webpages 43
Using CSS List Properties
• The default value for the list-style-position
property is outside, which displays the list item
with a bullet or number outside of the list’s
content block as in the following text:
1. Lorem ipsum dolor sit amet,
consectetur adipiscing elit.
Chapter 4: Applying CSS Styles to Webpages 44
Using CSS List Properties
(continued)
• Using inside as the value displays the bullet or
number inside the list’s content block, as in the
following text:
– Morbi odio nisl, facilisis non
egestas a, tristique vitae neque.
– Lorem ipsum dolor sit amet,
consectetur adipiscing elit.
Chapter 4: Applying CSS Styles to Webpages 45
Using CSS List Properties
(continued 2)
• Comments provide additional information about
the area where the styles are applied or other
helpful explanations, such as what the styles do
• The syntax for a comment is as follows:
/* Place your comment here */
Chapter 4: Applying CSS Styles to Webpages 46
Adding Comments to CSS Files
• The following steps validate a CSS file
– Open the browser and type
http://jigsaw.w3.org/css-validator/ in
the address bar to display the W3C CSS Validation
Service page
– Tap or click the By file upload tab to display the
Validate by file upload information
– Tap or click the Browse button to display the Choose
File to Upload dialog box
– Navigate to your css folder to find the styles.css file
(Figure 4–41)
Chapter 4: Applying CSS Styles to Webpages 47
To Validate the CSS File
Chapter 4: Applying CSS Styles to Webpages 48
To Validate the CSS File
(continued)
– Tap or click the styles.css document to select it
– Tap or click the Open button to upload the selected
file to the W3C CSS validator
– Tap or click the Check button to send the document
through the validator and display the validation results
page (Figure 4–42)
Chapter 4: Applying CSS Styles to Webpages 49
To Validate the CSS File
(continued 1)
Chapter 4: Applying CSS Styles to Webpages 50
To Validate the CSS File
(continued 2)
Chapter 4
Complete
HTML
8th Edition
Chapter 4: Applying CSS Styles to Webpages 51
Ad

More Related Content

What's hot (20)

Css selectors
Css selectorsCss selectors
Css selectors
Parth Trivedi
 
Span and Div tags in HTML
Span and Div tags in HTMLSpan and Div tags in HTML
Span and Div tags in HTML
Biswadip Goswami
 
CSS for Beginners
CSS for BeginnersCSS for Beginners
CSS for Beginners
Amit Kumar Singh
 
Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01
Hatem Mahmoud
 
Html text and formatting
Html text and formattingHtml text and formatting
Html text and formatting
eShikshak
 
Html images syntax
Html images syntaxHtml images syntax
Html images syntax
JayjZens
 
Html Basic Tags
Html Basic TagsHtml Basic Tags
Html Basic Tags
Richa Singh
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
WordPress Memphis
 
TUTORIAL ON PHOTOSHOP
TUTORIAL ON PHOTOSHOPTUTORIAL ON PHOTOSHOP
TUTORIAL ON PHOTOSHOP
Anamika Chauhan
 
User define data type In Visual Basic
User define data type In Visual Basic User define data type In Visual Basic
User define data type In Visual Basic
Shubham Dwivedi
 
Std 10 Computer Chapter 3 Handling Images in HTML (Part 1)
Std 10 Computer Chapter 3 Handling Images in HTML (Part 1)Std 10 Computer Chapter 3 Handling Images in HTML (Part 1)
Std 10 Computer Chapter 3 Handling Images in HTML (Part 1)
Nuzhat Memon
 
Photoshop Guide
Photoshop GuidePhotoshop Guide
Photoshop Guide
Marco Hernández
 
Html basics
Html basicsHtml basics
Html basics
mcatahir947
 
HTML Text formatting tags
HTML Text formatting tagsHTML Text formatting tags
HTML Text formatting tags
Himanshu Pathak
 
Presentation 12
Presentation   12Presentation   12
Presentation 12
sarvesh sharma
 
Introduction to CSS3
Introduction to CSS3Introduction to CSS3
Introduction to CSS3
Doris Chen
 
CSS - Text Properties
CSS - Text PropertiesCSS - Text Properties
CSS - Text Properties
hstryk
 
Html ppt
Html pptHtml ppt
Html ppt
Ruchi Kumari
 
Formatting in MS Excel
Formatting in MS ExcelFormatting in MS Excel
Formatting in MS Excel
Muhammad Yasir Bhutta
 
HTML-(workshop)7557.pptx
HTML-(workshop)7557.pptxHTML-(workshop)7557.pptx
HTML-(workshop)7557.pptx
Raja980775
 
Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01
Hatem Mahmoud
 
Html text and formatting
Html text and formattingHtml text and formatting
Html text and formatting
eShikshak
 
Html images syntax
Html images syntaxHtml images syntax
Html images syntax
JayjZens
 
User define data type In Visual Basic
User define data type In Visual Basic User define data type In Visual Basic
User define data type In Visual Basic
Shubham Dwivedi
 
Std 10 Computer Chapter 3 Handling Images in HTML (Part 1)
Std 10 Computer Chapter 3 Handling Images in HTML (Part 1)Std 10 Computer Chapter 3 Handling Images in HTML (Part 1)
Std 10 Computer Chapter 3 Handling Images in HTML (Part 1)
Nuzhat Memon
 
HTML Text formatting tags
HTML Text formatting tagsHTML Text formatting tags
HTML Text formatting tags
Himanshu Pathak
 
Introduction to CSS3
Introduction to CSS3Introduction to CSS3
Introduction to CSS3
Doris Chen
 
CSS - Text Properties
CSS - Text PropertiesCSS - Text Properties
CSS - Text Properties
hstryk
 
HTML-(workshop)7557.pptx
HTML-(workshop)7557.pptxHTML-(workshop)7557.pptx
HTML-(workshop)7557.pptx
Raja980775
 

Similar to HTML & CSS: Chapter 04 (20)

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
 
css.ppt
css.pptcss.ppt
css.ppt
SchoolEducationDepar
 
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
 
Css
CssCss
Css
Kamal Acharya
 
Web Development - Lecture 5
Web Development - Lecture 5Web Development - Lecture 5
Web Development - Lecture 5
Syed Shahzaib Sohail
 
Css
CssCss
Css
Army Public School and College -Faisal
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
smithaps4
 
cascadingstylesheets,introduction.css styles-210909054722.pptx
cascadingstylesheets,introduction.css styles-210909054722.pptxcascadingstylesheets,introduction.css styles-210909054722.pptx
cascadingstylesheets,introduction.css styles-210909054722.pptx
hannahroseline2
 
Css introduction
Css introductionCss introduction
Css introduction
Sridhar P
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
smitha273566
 
Castro Chapter 8
Castro Chapter 8Castro Chapter 8
Castro Chapter 8
Jeff Byrnes
 
9781111528705_PPT_ch04.ppt
9781111528705_PPT_ch04.ppt9781111528705_PPT_ch04.ppt
9781111528705_PPT_ch04.ppt
SimonChirambira
 
BITM3730Week4.pptx
BITM3730Week4.pptxBITM3730Week4.pptx
BITM3730Week4.pptx
MattMarino13
 
BITM3730 9-19.pptx
BITM3730 9-19.pptxBITM3730 9-19.pptx
BITM3730 9-19.pptx
MattMarino13
 
BITM3730 9-20.pptx
BITM3730 9-20.pptxBITM3730 9-20.pptx
BITM3730 9-20.pptx
MattMarino13
 
Slides-Online-Week2-Website-Frontend-CSS.pptx
Slides-Online-Week2-Website-Frontend-CSS.pptxSlides-Online-Week2-Website-Frontend-CSS.pptx
Slides-Online-Week2-Website-Frontend-CSS.pptx
ahmadraza72678
 
Css
CssCss
Css
Hemant Saini
 
DW unit 3.pptx
DW unit 3.pptxDW unit 3.pptx
DW unit 3.pptx
SeethaDinesh
 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
Salman Memon
 
Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designers
Singsys Pte Ltd
 
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
 
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
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
smithaps4
 
cascadingstylesheets,introduction.css styles-210909054722.pptx
cascadingstylesheets,introduction.css styles-210909054722.pptxcascadingstylesheets,introduction.css styles-210909054722.pptx
cascadingstylesheets,introduction.css styles-210909054722.pptx
hannahroseline2
 
Css introduction
Css introductionCss introduction
Css introduction
Sridhar P
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
smitha273566
 
Castro Chapter 8
Castro Chapter 8Castro Chapter 8
Castro Chapter 8
Jeff Byrnes
 
9781111528705_PPT_ch04.ppt
9781111528705_PPT_ch04.ppt9781111528705_PPT_ch04.ppt
9781111528705_PPT_ch04.ppt
SimonChirambira
 
BITM3730Week4.pptx
BITM3730Week4.pptxBITM3730Week4.pptx
BITM3730Week4.pptx
MattMarino13
 
BITM3730 9-19.pptx
BITM3730 9-19.pptxBITM3730 9-19.pptx
BITM3730 9-19.pptx
MattMarino13
 
BITM3730 9-20.pptx
BITM3730 9-20.pptxBITM3730 9-20.pptx
BITM3730 9-20.pptx
MattMarino13
 
Slides-Online-Week2-Website-Frontend-CSS.pptx
Slides-Online-Week2-Website-Frontend-CSS.pptxSlides-Online-Week2-Website-Frontend-CSS.pptx
Slides-Online-Week2-Website-Frontend-CSS.pptx
ahmadraza72678
 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
Salman Memon
 
Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designers
Singsys Pte Ltd
 
Ad

More from Steve Guinan (20)

Chapter 18: Transitions, Transforms, and Animation
Chapter 18: Transitions, Transforms, and AnimationChapter 18: Transitions, Transforms, and Animation
Chapter 18: Transitions, Transforms, and Animation
Steve Guinan
 
Chapter 17: Responsive Web Design
Chapter 17: Responsive Web DesignChapter 17: Responsive Web Design
Chapter 17: Responsive Web Design
Steve Guinan
 
Chapter 15: Floating and Positioning
Chapter 15: Floating and Positioning Chapter 15: Floating and Positioning
Chapter 15: Floating and Positioning
Steve Guinan
 
Chapter 9: Forms
Chapter 9: FormsChapter 9: Forms
Chapter 9: Forms
Steve Guinan
 
Chapter 8: Tables
Chapter 8: TablesChapter 8: Tables
Chapter 8: Tables
Steve Guinan
 
Chapter 14: Box Model
Chapter 14: Box ModelChapter 14: Box Model
Chapter 14: Box Model
Steve Guinan
 
Chapter 13: Colors and Backgrounds
Chapter 13: Colors and BackgroundsChapter 13: Colors and Backgrounds
Chapter 13: Colors and Backgrounds
Steve Guinan
 
Chapter 12: CSS Part 2
Chapter 12: CSS Part 2Chapter 12: CSS Part 2
Chapter 12: CSS Part 2
Steve Guinan
 
Chapter 11: Intro to CSS
Chapter 11: Intro to CSSChapter 11: Intro to CSS
Chapter 11: Intro to CSS
Steve Guinan
 
Chapter 23: Web Images
Chapter 23: Web ImagesChapter 23: Web Images
Chapter 23: Web Images
Steve Guinan
 
Chapter 7: Images
Chapter 7: ImagesChapter 7: Images
Chapter 7: Images
Steve Guinan
 
HubSpot Student Instructions
HubSpot Student InstructionsHubSpot Student Instructions
HubSpot Student Instructions
Steve Guinan
 
Ch 6: Links
Ch 6: LinksCh 6: Links
Ch 6: Links
Steve Guinan
 
Ch 5: Marking up Text
Ch 5: Marking up TextCh 5: Marking up Text
Ch 5: Marking up Text
Steve Guinan
 
Ch 3: Big Concepts
Ch 3: Big ConceptsCh 3: Big Concepts
Ch 3: Big Concepts
Steve Guinan
 
Ch 2: How the Web Works
Ch 2: How the Web WorksCh 2: How the Web Works
Ch 2: How the Web Works
Steve Guinan
 
Ch 1: Getting Started
Ch 1: Getting StartedCh 1: Getting Started
Ch 1: Getting Started
Steve Guinan
 
Intro to Web Design 6e Chapter 7
Intro to Web Design 6e Chapter 7Intro to Web Design 6e Chapter 7
Intro to Web Design 6e Chapter 7
Steve Guinan
 
Intro to Web Design 6e Chapter 6
Intro to Web Design 6e Chapter 6Intro to Web Design 6e Chapter 6
Intro to Web Design 6e Chapter 6
Steve Guinan
 
Intro to Web Design 6e Chapter 5
Intro to Web Design 6e Chapter 5Intro to Web Design 6e Chapter 5
Intro to Web Design 6e Chapter 5
Steve Guinan
 
Chapter 18: Transitions, Transforms, and Animation
Chapter 18: Transitions, Transforms, and AnimationChapter 18: Transitions, Transforms, and Animation
Chapter 18: Transitions, Transforms, and Animation
Steve Guinan
 
Chapter 17: Responsive Web Design
Chapter 17: Responsive Web DesignChapter 17: Responsive Web Design
Chapter 17: Responsive Web Design
Steve Guinan
 
Chapter 15: Floating and Positioning
Chapter 15: Floating and Positioning Chapter 15: Floating and Positioning
Chapter 15: Floating and Positioning
Steve Guinan
 
Chapter 14: Box Model
Chapter 14: Box ModelChapter 14: Box Model
Chapter 14: Box Model
Steve Guinan
 
Chapter 13: Colors and Backgrounds
Chapter 13: Colors and BackgroundsChapter 13: Colors and Backgrounds
Chapter 13: Colors and Backgrounds
Steve Guinan
 
Chapter 12: CSS Part 2
Chapter 12: CSS Part 2Chapter 12: CSS Part 2
Chapter 12: CSS Part 2
Steve Guinan
 
Chapter 11: Intro to CSS
Chapter 11: Intro to CSSChapter 11: Intro to CSS
Chapter 11: Intro to CSS
Steve Guinan
 
Chapter 23: Web Images
Chapter 23: Web ImagesChapter 23: Web Images
Chapter 23: Web Images
Steve Guinan
 
HubSpot Student Instructions
HubSpot Student InstructionsHubSpot Student Instructions
HubSpot Student Instructions
Steve Guinan
 
Ch 5: Marking up Text
Ch 5: Marking up TextCh 5: Marking up Text
Ch 5: Marking up Text
Steve Guinan
 
Ch 3: Big Concepts
Ch 3: Big ConceptsCh 3: Big Concepts
Ch 3: Big Concepts
Steve Guinan
 
Ch 2: How the Web Works
Ch 2: How the Web WorksCh 2: How the Web Works
Ch 2: How the Web Works
Steve Guinan
 
Ch 1: Getting Started
Ch 1: Getting StartedCh 1: Getting Started
Ch 1: Getting Started
Steve Guinan
 
Intro to Web Design 6e Chapter 7
Intro to Web Design 6e Chapter 7Intro to Web Design 6e Chapter 7
Intro to Web Design 6e Chapter 7
Steve Guinan
 
Intro to Web Design 6e Chapter 6
Intro to Web Design 6e Chapter 6Intro to Web Design 6e Chapter 6
Intro to Web Design 6e Chapter 6
Steve Guinan
 
Intro to Web Design 6e Chapter 5
Intro to Web Design 6e Chapter 5Intro to Web Design 6e Chapter 5
Intro to Web Design 6e Chapter 5
Steve Guinan
 
Ad

Recently uploaded (20)

The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...
Sandeep Swamy
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Library Association of Ireland
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACYUNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
DR.PRISCILLA MARY J
 
Sinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_NameSinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_Name
keshanf79
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Library Association of Ireland
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdfBiophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
PKLI-Institute of Nursing and Allied Health Sciences Lahore , Pakistan.
 
How to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odooHow to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odoo
Celine George
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...
Sandeep Swamy
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Library Association of Ireland
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACYUNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
DR.PRISCILLA MARY J
 
Sinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_NameSinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_Name
keshanf79
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Library Association of Ireland
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
How to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odooHow to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odoo
Celine George
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 

HTML & CSS: Chapter 04

  • 1. Applying CSS Styles to Webpages Web Design with HTML5 & CSS3 8th Edition
  • 2. • Explain the importance of separating design from content • Describe Cascading Style Sheets (CSS) • Define inline, embedded, and external styles and their order of precedence • Describe a CSS rule and its syntax • Explain the difference between a selector, property, and value Chapter 4: Applying CSS Styles to Webpages 2 Objectives
  • 3. • Create styles that use text and color properties • Explain the difference between inline and block content • Describe the CSS box model and how to apply margins, padding, and borders • Create an external style sheet and link it to an HTML page Chapter 4: Applying CSS Styles to Webpages 3 Objectives (continued)
  • 4. • Create styles that use padding, border, and margin properties • Float an image • Create styles that use list properties • Add comments to an external style sheet • Validate a CSS file Chapter 4: Applying CSS Styles to Webpages 4 Objectives (continued 1)
  • 5. • Style – It is a rule that defines the appearance of an element on a webpage • Style sheet – It is the set of CSS style rules • Style sheets provide a means to separate style from content because it gives the flexibility to redesign or rebrand a website • A single CSS style sheet file containing the defined styles can be attached to several webpages to apply the styles to all the attached pages Chapter 4: Applying CSS Styles to Webpages 5 Using Cascading Style Sheets
  • 6. • Inline style – It is used to add a style to the start tag for an element, such as a heading or paragraph, using the style attribute Chapter 4: Applying CSS Styles to Webpages 6 Inline Styles
  • 7. • An embedded style sheet, also called an internal style sheet, includes the style sheet within the opening <head> and closing </head> tags of the HTML document Chapter 4: Applying CSS Styles to Webpages 7 Embedded Style Sheets
  • 8. • An external style sheet – It is a CSS file that contains all of the styles that can be applied to more than one page in a website • External style sheets are also called linked style sheets • An external style sheet is a text file with the .css extension • To apply an external style sheet, link it (or attach it) to a webpage using a link in the head section of the webpage Chapter 4: Applying CSS Styles to Webpages 8 External Style Sheets
  • 9. • External style sheet provides flexibility to quickly change webpage formats because the styles used in it are applied to every page linked to it • Changing the look of an entire website is sometimes called reskinning the website Chapter 4: Applying CSS Styles to Webpages 9 External Style Sheets (continued)
  • 10. • Style sheets are said to “cascade” because each type of style has a specified level of precedence (or priority) in relationship to the others • CSS properties can be inherited from a parent element through a principle called inheritance • If a selector has more than one CSS rule, specificity determines which CSS rule to apply Chapter 4: Applying CSS Styles to Webpages 10 Style Sheet Precedence
  • 11. • Each CSS rule consists of a selector and a declaration Chapter 4: Applying CSS Styles to Webpages 11 CSS Basics
  • 12. • Selector – It is the part of the statement that identifies what to style • Any HTML5 element such as body, header, nav, main, or footer may be a selector • A selector may also be the value of an id or class attribute • The declaration defines the exact formatting of the style Chapter 4: Applying CSS Styles to Webpages 12 CSS Basics (continued)
  • 13. • A declaration consists of a property and a value, separated by a colon and followed by a semicolon • The property identifies the style quality or characteristic to apply, such as – color (text color) – background-color – text-indent – border-width – font-style Chapter 4: Applying CSS Styles to Webpages 13 CSS Basics (continued 1)
  • 14. • For each property, the declaration includes a related value that identifies the particular property value to apply Chapter 4: Applying CSS Styles to Webpages 14 CSS Basics (continued 2)
  • 15. Chapter 4: Applying CSS Styles to Webpages 15 CSS Basics (continued 3)
  • 16. Chapter 4: Applying CSS Styles to Webpages 16 CSS Text Properties
  • 17. • Fallback values – They are the additional values provided for the font-family property in case the browser does not support the primary font • CSS measures font sizes using many measurement units, including pixels, points, and ems, and by keyword or percentage Chapter 4: Applying CSS Styles to Webpages 17 CSS Text Properties (continued)
  • 18. Chapter 4: Applying CSS Styles to Webpages 18 CSS Text Properties (continued 1)
  • 19. • HTML uses color names or codes to designate color values • Two types of color codes can be used with CSS: – Hexadecimal – RGB • Hexadecimal values consist of a six-digit number code that corresponds to RGB (Red, Green, Blue) color values Chapter 4: Applying CSS Styles to Webpages 19 CSS Colors
  • 20. Chapter 4: Applying CSS Styles to Webpages 20 CSS Colors (continued) • To use a color in a style rule declaration, use the color value as the property value • For example, to style a background color as gray use, background-color: #808080;
  • 21. • HTML elements are positioned on the webpage as a block or as inline content • A block element appears as a block because it starts and ends with a new line, such as the main element or a paragraph element • Inline elements are displayed without line breaks so they flow within the same line • Inline content always appears within block elements Chapter 4: Applying CSS Styles to Webpages 21 Understanding Inline Elements and Block Elements
  • 22. • Each block element such as a header, nav, main, and footer element is displayed in a browser as a box with content • The CSS box model describes content boxes on a webpage Chapter 4: Applying CSS Styles to Webpages 22 CSS Box Model
  • 23. • Each content box can have margins, borders, and padding • The margin provides passive white space between block elements or between the top or bottom of a webpage • The border separates the padding and the margin of the block element • Padding is the passive white space between the content and the border of a block element Chapter 4: Applying CSS Styles to Webpages 23 CSS Box Model (continued)
  • 24. Chapter 4: Applying CSS Styles to Webpages 24 CSS Box Model (continued 1)
  • 25. • A style rule begins with a selector, which specifies the element to style • A selector can be – an HTML element name – an id attribute value – a class attribute value • An id or a class selector is used to apply styles to p elements Chapter 4: Applying CSS Styles to Webpages 25 Selectors
  • 26. • An id selector uses the id attribute value of an HTML element to select a single element • For example, to style the div id="container" element, use #container as the selector #container { border: solid 2px; } Chapter 4: Applying CSS Styles to Webpages 26 Selectors (continued)
  • 27. • A class selector is used to select elements that include a certain class attribute • For example, to style class="mobile", use .mobile as the selector .mobile { font-size: 10pt; } Chapter 4: Applying CSS Styles to Webpages 27 Selectors (continued 1)
  • 28. • A descendant selector is used to create style that applies to an element contained within another element • For example, the following style rule sets the list- style property to none for list items in an unordered list included in the navigation area: nav ul li { list-style: none; } Chapter 4: Applying CSS Styles to Webpages 28 Selectors (continued 2)
  • 29. Chapter 4: Applying CSS Styles to Webpages 29 To Create a CSS File and a Style Rule for the Body Element
  • 30. • After creating a CSS file, link it to all the webpages that will use its styles • Insert a link element on the HTML page within the <head> and </head> tags • The link element uses two attributes: – rel – href • The rel attribute uses the stylesheet value to indicate that the document is linked to a style sheet Chapter 4: Applying CSS Styles to Webpages 30 Linking an HTML Document to a CSS File
  • 31. • The href attribute value specifies the file path or file name of the CSS file • Following is an example of a link to a style sheet named styles.css and stored in the css folder: <link rel="stylesheet" href="css/styles.css"> • The type="text/css" attribute and value is also commonly used within a link element to reference a CSS file Chapter 4: Applying CSS Styles to Webpages 31 Linking an HTML Document to a CSS File (continued)
  • 32. • One way to align webpage content is to use the text-align property, which applies to block elements • The text-align property can use left (the default), center, right, or justify as its value • For example, the following rule centers an h1 element: h1 { text-align: center; } Chapter 4: Applying CSS Styles to Webpages 32 Aligning Webpage Content
  • 33. • To center all of the elements of a webpage using a single style rule, set the left and right margins to auto • In addition, set the width to 80% so that the elements do not span 100 percent of the browser window Chapter 4: Applying CSS Styles to Webpages 33 To Center Content
  • 34. • The header section appears at the top of a webpage and thus needs formatting that makes the header contents stand out and attract visitors to the page • The nav section should be formatted differently from the other structural elements as it should be prominent and easy to find on the webpage • The main section should be formatted using the display property Chapter 4: Applying CSS Styles to Webpages 34 Creating Style Rules for Structural Elements
  • 35. • To apply text and box model properties to the main section and have them appear as intended, the display property is used • Create a style rule that formats the footer section by defining the font size, text alignment, and top margin of the footer element Chapter 4: Applying CSS Styles to Webpages 35 Creating Style Rules for Structural Elements (continued)
  • 36. Chapter 4: Applying CSS Styles to Webpages 36 To Create a Style Rule for the Header Element
  • 37. Chapter 4: Applying CSS Styles to Webpages 37 To Create a Style Rule for the Nav Element
  • 38. Chapter 4: Applying CSS Styles to Webpages 38 To Create a Style Rule for the Main Element
  • 39. Chapter 4: Applying CSS Styles to Webpages 39 To Create a Style Rule for the Footer Element
  • 40. • Consider the following example: <img class="equip" src="images/equipment1.jpg" alt="Weight Equipment" height="195" width="260"> – The img element displays the equipment1.jpg image – The first attribute and value, class="equip", assigns this element to the equip class – Including the class="equip" attribute and value in each img element helps format all the elements assigned to the equip class with a single style rule Chapter 4: Applying CSS Styles to Webpages 40 Creating Style Rules for Classes
  • 41. • For example, the following style rule adds 20 pixels of padding to the right side of elements in the equip class: .equip { padding-right: 20px; } Chapter 4: Applying CSS Styles to Webpages 41 Creating Style Rules for Classes (continued)
  • 42. • To indicate a class name as a selector, include a period (.) before the class name • Float property – It positions an element to the right or left of other elements • Clear property – It removes the float effect from a webpage Chapter 4: Applying CSS Styles to Webpages 42 Creating Style Rules for Classes (continued 1)
  • 43. • The CSS list-style properties are used to control the appearance of numbered and bulleted lists • Lists marked with the <ul> and </ul> tags display a solid bullet before each list item • Lists marked with the <ol> and </ol> tags display Arabic numerals (1, 2, 3, and so on) before the list items • For example, ul { list-style-type: square; } Chapter 4: Applying CSS Styles to Webpages 43 Using CSS List Properties
  • 44. • The default value for the list-style-position property is outside, which displays the list item with a bullet or number outside of the list’s content block as in the following text: 1. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Chapter 4: Applying CSS Styles to Webpages 44 Using CSS List Properties (continued)
  • 45. • Using inside as the value displays the bullet or number inside the list’s content block, as in the following text: – Morbi odio nisl, facilisis non egestas a, tristique vitae neque. – Lorem ipsum dolor sit amet, consectetur adipiscing elit. Chapter 4: Applying CSS Styles to Webpages 45 Using CSS List Properties (continued 2)
  • 46. • Comments provide additional information about the area where the styles are applied or other helpful explanations, such as what the styles do • The syntax for a comment is as follows: /* Place your comment here */ Chapter 4: Applying CSS Styles to Webpages 46 Adding Comments to CSS Files
  • 47. • The following steps validate a CSS file – Open the browser and type http://jigsaw.w3.org/css-validator/ in the address bar to display the W3C CSS Validation Service page – Tap or click the By file upload tab to display the Validate by file upload information – Tap or click the Browse button to display the Choose File to Upload dialog box – Navigate to your css folder to find the styles.css file (Figure 4–41) Chapter 4: Applying CSS Styles to Webpages 47 To Validate the CSS File
  • 48. Chapter 4: Applying CSS Styles to Webpages 48 To Validate the CSS File (continued)
  • 49. – Tap or click the styles.css document to select it – Tap or click the Open button to upload the selected file to the W3C CSS validator – Tap or click the Check button to send the document through the validator and display the validation results page (Figure 4–42) Chapter 4: Applying CSS Styles to Webpages 49 To Validate the CSS File (continued 1)
  • 50. Chapter 4: Applying CSS Styles to Webpages 50 To Validate the CSS File (continued 2)
  • 51. Chapter 4 Complete HTML 8th Edition Chapter 4: Applying CSS Styles to Webpages 51