SlideShare a Scribd company logo
1 of 31
Tutorial 4
Formatting Text and Links

Blended HTML and CSS
Fundamentals
3rd EDITION
Objectives 4.1
•
•
•
•
•

XP

Specify the vertical alignment of an element
Define list styles
Implement grouped selectors
Incorporate descendant selectors
Style a list as a navigation bar

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

2
Objectives 4.2

XP

• Work with dependent and independent
classes
• Set an image as a list marker
• Create dynamic pseudo-classes

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

3
Using the vertical-align
Property

XP

• Use the vertical-align property to
position images and other elements vertically
with text.
• The property has several possible values:
– top – The top of the image is aligned with the
text.
– middle – The image is aligned vertically
centered with the text.
– bottom – The bottom of the image is aligned
with the text.
New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

4
Using the vertical-align
Property

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

XP

5
Using the vertical-align
Property

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

XP

6
The vertical-align Property
Values

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

XP

7
Changing the Appearance of Lists XP
• Lists can be enhanced by graphics and images.
• The following properties can be used:
– list-style-type: stylevalue;
– list-style-position:
positionvalue;
– list-style-image: url(imagename);
– Shorthand property:
list-style: stylevalue
url(imagename) positionvalue;

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

8
Using the list-style-type
Property

XP

• Use the list-style-type property to change
the appearance of the default solid bullet for
unordered lists.
• There are four list-style-type values for
unordered lists:
– disc – a filled circle (the default)
– circle – a hollow circle
– square – a filled square
– none – no bullet is shown
ul {
list-style-type: value;
}
New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

9
Using the list-style-type
Property

XP

• There are the following list-style-type values
for ordered lists:
– decimal
– decimal-leading-zero
– lower-roman
– upper-roman
– lower-alpha
– upper-alpha
– none
ol {
list-style-type: value;
}
New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

10
Using the list-style-type
Property

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

XP

11
Using the list-style-positionXP
Property
• Use the list-style-position property to
change the position of the marker or bullet included
with a list.
• There are two list-style-position values:
– inside
– outside

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

12
Using Groups of Selectors

XP

• Grouped selectors are selectors that share a
common set of declarations and that are
grouped into a comma-separated list.

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

13
Using Descendant Selectors

XP

• A descendant selector is a selector nested
within another selector.
• A space is used, without a comma, to indicate
descendant selectors.
• A comma is used between selectors when the
style applies to all selectors in the group.
strong em {
color: maroon;
}
New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

14
Using Descendant Selectors

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

XP

15
Styling a List of Hyperlinks

XP

• The nav element identifies a block of
navigation links.

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

16
Styling a List of Hyperlinks

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

XP

17
CSS Inheritance

XP

• CSS inheritance is a method whereby a child
element inherits characteristics from its parent
element.

• The nav element is a parent of the ul
element, and the ul element is a parent of
the li element.
New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

18
CSS Class Selector

XP

• A class selector is a name preceded by a
period.
• This name can then be applied to any HTML
element.
• Class selectors can format one or more
instances of an element.
• A class must be applied to the start tag of one
or more elements on a Web page.
• Classes can be dependent or independent.
New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

19
Dependent Class

XP

• A dependent class styles a particular element.
• Code syntax:
selector.dependentclass {
property1: value;
property2: value;
}
selector – the name of the element
dependentclass – the name of the dependent
class

• To apply the dependent class to an element:
<element class = "dependentclass">
New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

20
Rules for Class Names

XP

• A class name can contain only alphabetic or numeric
characters.
• A class name must be one word (no spaces).
• A class name should describe the purpose of the
class.
• A class name should not begin with a number
because not all browsers will recognize it.

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

21
Dependent Selector Code

XP

Code to apply the attention class:
<li class = "attention">Your name and
contact information</li>

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

22
Independent Class

XP

• An independent class styles any element.
• Code syntax:
selector.independentclass {
property1: value;
property2: value;
}
selector – the name of the element
independentclass – the name of the dependent
class

• To apply an independent class to any element:
<element class = "independentclass">
New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

23
Independent Selector Code

XP

Code to apply the center class:

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

24
Using the list-style-image
Property

XP

• Use the list-style-image property to
specify a graphic image instead of a bullet
marker for a list.
• Use a very small image for a bullet marker.
• Code example:
ul {
list-style-image: url(star.gif);
}

• url points to the image used as a bullet
marker.
New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

25
Using the span Element

XP

• The span element is a generic element that
does not have any specific meaning, but it
allows you to mark inline content.
• span element syntax:
<span>content</span>

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

26
Pseudo-Class Selectors

XP

• A pseudo-class is a class that exists in CSS but
is not directly defined in HTML.
• Pseudo-classes associated with the anchor
element are used to achieve the mouse-over
effect.
• Link color defines the link state, which is
whether a hyperlink has been clicked or not.

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

27
XP
The Anchor Pseudo-Class Selectors

• Using the anchor pseudo-class selectors,
hyperlinks can be styled, based on the
following four states:
– a:link is the selector for normal links.
– a:visited is the selector for visited links.
– a:hover is the selector for the hover state (when the
mouse pointer passes over the link).
– a:active is the selector for active links (when a user
holds down the mouse button to click a link).

• Note that the colon does not have spaces
before and after it.
New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

28
XP
The Anchor Pseudo-Class Selectors

+

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

29
Setting Margins

XP

• The following properties are used to set
margins:
– margin-top
– margin-right
– margin-bottom
– margin-left

• Order is irrelevant.

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

30
Setting Margins

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

XP

31

More Related Content

What's hot

Unit I Database concepts - RDBMS & ORACLE
Unit I  Database concepts - RDBMS & ORACLEUnit I  Database concepts - RDBMS & ORACLE
Unit I Database concepts - RDBMS & ORACLEDrkhanchanaR
 
Css specificity inheritance and the cascade things you should know
Css specificity inheritance and the cascade things you should knowCss specificity inheritance and the cascade things you should know
Css specificity inheritance and the cascade things you should knowMoneer kamal
 
documents writing with LATEX
documents writing with LATEXdocuments writing with LATEX
documents writing with LATEXAnusha Vajrapu
 
UML for OOAD
UML for OOADUML for OOAD
UML for OOADDang Tuan
 
analysis and design with uml
analysis and design with umlanalysis and design with uml
analysis and design with umlsabin kafle
 

What's hot (8)

Unit I Database concepts - RDBMS & ORACLE
Unit I  Database concepts - RDBMS & ORACLEUnit I  Database concepts - RDBMS & ORACLE
Unit I Database concepts - RDBMS & ORACLE
 
Sql select
Sql select Sql select
Sql select
 
Css specificity inheritance and the cascade things you should know
Css specificity inheritance and the cascade things you should knowCss specificity inheritance and the cascade things you should know
Css specificity inheritance and the cascade things you should know
 
documents writing with LATEX
documents writing with LATEXdocuments writing with LATEX
documents writing with LATEX
 
UML for OOAD
UML for OOADUML for OOAD
UML for OOAD
 
Cs8592 ooad unit 1
Cs8592 ooad unit 1Cs8592 ooad unit 1
Cs8592 ooad unit 1
 
Technical writing using LaTeX
Technical writing using LaTeXTechnical writing using LaTeX
Technical writing using LaTeX
 
analysis and design with uml
analysis and design with umlanalysis and design with uml
analysis and design with uml
 

Similar to Formatting Text and Links

Introducing Cascading Style Sheets
Introducing Cascading Style SheetsIntroducing Cascading Style Sheets
Introducing Cascading Style SheetsBravocash
 
CSS Selectors and Fonts
CSS Selectors and FontsCSS Selectors and Fonts
CSS Selectors and Fontskjkleindorfer
 
Using HTML to Create Web Pages
Using HTML to Create Web PagesUsing HTML to Create Web Pages
Using HTML to Create Web PagesBravocash
 
Cascading Style Sheets(CSS)
Cascading Style Sheets(CSS)Cascading Style Sheets(CSS)
Cascading Style Sheets(CSS)Reshmi Rajan
 
Chapter 2 Getting Started with CSS
Chapter 2 Getting Started with CSSChapter 2 Getting Started with CSS
Chapter 2 Getting Started with CSSDr. Ahmed Al Zaidy
 
Web Concepts_Introduction to presentation.pptx
Web Concepts_Introduction to presentation.pptxWeb Concepts_Introduction to presentation.pptx
Web Concepts_Introduction to presentation.pptxclement swarnappa
 
Automated Analysis of CSS Rules to Support Style Maintenance
Automated Analysis of CSS Rules to Support Style MaintenanceAutomated Analysis of CSS Rules to Support Style Maintenance
Automated Analysis of CSS Rules to Support Style MaintenanceAbhishek Rakshe
 
Ita3.2 structural and semantic element theory
Ita3.2 structural and semantic element theoryIta3.2 structural and semantic element theory
Ita3.2 structural and semantic element theoryFrank Robell
 
Chapter 6 Working with Tables and Columns
Chapter 6 Working with Tables and ColumnsChapter 6 Working with Tables and Columns
Chapter 6 Working with Tables and ColumnsDr. Ahmed Al Zaidy
 
Cascading Style Sheet | CSS
Cascading Style Sheet | CSSCascading Style Sheet | CSS
Cascading Style Sheet | CSSMSA Technosoft
 
Css tutorial by viveksingh698@gmail.com
Css tutorial by viveksingh698@gmail.comCss tutorial by viveksingh698@gmail.com
Css tutorial by viveksingh698@gmail.comvivek698
 

Similar to Formatting Text and Links (20)

Introducing Cascading Style Sheets
Introducing Cascading Style SheetsIntroducing Cascading Style Sheets
Introducing Cascading Style Sheets
 
CSS Selectors and Fonts
CSS Selectors and FontsCSS Selectors and Fonts
CSS Selectors and Fonts
 
Using HTML to Create Web Pages
Using HTML to Create Web PagesUsing HTML to Create Web Pages
Using HTML to Create Web Pages
 
Css syntax
Css   syntaxCss   syntax
Css syntax
 
Cascading Style Sheets(CSS)
Cascading Style Sheets(CSS)Cascading Style Sheets(CSS)
Cascading Style Sheets(CSS)
 
introduction to CSS
introduction to CSSintroduction to CSS
introduction to CSS
 
Chapter 2 Getting Started with CSS
Chapter 2 Getting Started with CSSChapter 2 Getting Started with CSS
Chapter 2 Getting Started with CSS
 
Web Concepts_Introduction to presentation.pptx
Web Concepts_Introduction to presentation.pptxWeb Concepts_Introduction to presentation.pptx
Web Concepts_Introduction to presentation.pptx
 
Automated Analysis of CSS Rules to Support Style Maintenance
Automated Analysis of CSS Rules to Support Style MaintenanceAutomated Analysis of CSS Rules to Support Style Maintenance
Automated Analysis of CSS Rules to Support Style Maintenance
 
Ita3.2 structural and semantic element theory
Ita3.2 structural and semantic element theoryIta3.2 structural and semantic element theory
Ita3.2 structural and semantic element theory
 
Apex code (Salesforce)
Apex code (Salesforce)Apex code (Salesforce)
Apex code (Salesforce)
 
Csstutorial
CsstutorialCsstutorial
Csstutorial
 
Chapter 6 Working with Tables and Columns
Chapter 6 Working with Tables and ColumnsChapter 6 Working with Tables and Columns
Chapter 6 Working with Tables and Columns
 
Css
CssCss
Css
 
Cascading Style Sheet | CSS
Cascading Style Sheet | CSSCascading Style Sheet | CSS
Cascading Style Sheet | CSS
 
Css tutorial by viveksingh698@gmail.com
Css tutorial by viveksingh698@gmail.comCss tutorial by viveksingh698@gmail.com
Css tutorial by viveksingh698@gmail.com
 
Css tutorial
Css tutorialCss tutorial
Css tutorial
 
Css tutorial
Css tutorialCss tutorial
Css tutorial
 
Css tutorial
Css tutorial Css tutorial
Css tutorial
 
Css1
Css1Css1
Css1
 

Recently uploaded

Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIShubhangi Sonawane
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 

Recently uploaded (20)

Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 

Formatting Text and Links

  • 1. Tutorial 4 Formatting Text and Links Blended HTML and CSS Fundamentals 3rd EDITION
  • 2. Objectives 4.1 • • • • • XP Specify the vertical alignment of an element Define list styles Implement grouped selectors Incorporate descendant selectors Style a list as a navigation bar New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 2
  • 3. Objectives 4.2 XP • Work with dependent and independent classes • Set an image as a list marker • Create dynamic pseudo-classes New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 3
  • 4. Using the vertical-align Property XP • Use the vertical-align property to position images and other elements vertically with text. • The property has several possible values: – top – The top of the image is aligned with the text. – middle – The image is aligned vertically centered with the text. – bottom – The bottom of the image is aligned with the text. New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 4
  • 5. Using the vertical-align Property New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition XP 5
  • 6. Using the vertical-align Property New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition XP 6
  • 7. The vertical-align Property Values New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition XP 7
  • 8. Changing the Appearance of Lists XP • Lists can be enhanced by graphics and images. • The following properties can be used: – list-style-type: stylevalue; – list-style-position: positionvalue; – list-style-image: url(imagename); – Shorthand property: list-style: stylevalue url(imagename) positionvalue; New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 8
  • 9. Using the list-style-type Property XP • Use the list-style-type property to change the appearance of the default solid bullet for unordered lists. • There are four list-style-type values for unordered lists: – disc – a filled circle (the default) – circle – a hollow circle – square – a filled square – none – no bullet is shown ul { list-style-type: value; } New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 9
  • 10. Using the list-style-type Property XP • There are the following list-style-type values for ordered lists: – decimal – decimal-leading-zero – lower-roman – upper-roman – lower-alpha – upper-alpha – none ol { list-style-type: value; } New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 10
  • 11. Using the list-style-type Property New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition XP 11
  • 12. Using the list-style-positionXP Property • Use the list-style-position property to change the position of the marker or bullet included with a list. • There are two list-style-position values: – inside – outside New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 12
  • 13. Using Groups of Selectors XP • Grouped selectors are selectors that share a common set of declarations and that are grouped into a comma-separated list. New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 13
  • 14. Using Descendant Selectors XP • A descendant selector is a selector nested within another selector. • A space is used, without a comma, to indicate descendant selectors. • A comma is used between selectors when the style applies to all selectors in the group. strong em { color: maroon; } New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 14
  • 15. Using Descendant Selectors New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition XP 15
  • 16. Styling a List of Hyperlinks XP • The nav element identifies a block of navigation links. New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 16
  • 17. Styling a List of Hyperlinks New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition XP 17
  • 18. CSS Inheritance XP • CSS inheritance is a method whereby a child element inherits characteristics from its parent element. • The nav element is a parent of the ul element, and the ul element is a parent of the li element. New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 18
  • 19. CSS Class Selector XP • A class selector is a name preceded by a period. • This name can then be applied to any HTML element. • Class selectors can format one or more instances of an element. • A class must be applied to the start tag of one or more elements on a Web page. • Classes can be dependent or independent. New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 19
  • 20. Dependent Class XP • A dependent class styles a particular element. • Code syntax: selector.dependentclass { property1: value; property2: value; } selector – the name of the element dependentclass – the name of the dependent class • To apply the dependent class to an element: <element class = "dependentclass"> New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 20
  • 21. Rules for Class Names XP • A class name can contain only alphabetic or numeric characters. • A class name must be one word (no spaces). • A class name should describe the purpose of the class. • A class name should not begin with a number because not all browsers will recognize it. New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 21
  • 22. Dependent Selector Code XP Code to apply the attention class: <li class = "attention">Your name and contact information</li> New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 22
  • 23. Independent Class XP • An independent class styles any element. • Code syntax: selector.independentclass { property1: value; property2: value; } selector – the name of the element independentclass – the name of the dependent class • To apply an independent class to any element: <element class = "independentclass"> New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 23
  • 24. Independent Selector Code XP Code to apply the center class: New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 24
  • 25. Using the list-style-image Property XP • Use the list-style-image property to specify a graphic image instead of a bullet marker for a list. • Use a very small image for a bullet marker. • Code example: ul { list-style-image: url(star.gif); } • url points to the image used as a bullet marker. New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 25
  • 26. Using the span Element XP • The span element is a generic element that does not have any specific meaning, but it allows you to mark inline content. • span element syntax: <span>content</span> New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 26
  • 27. Pseudo-Class Selectors XP • A pseudo-class is a class that exists in CSS but is not directly defined in HTML. • Pseudo-classes associated with the anchor element are used to achieve the mouse-over effect. • Link color defines the link state, which is whether a hyperlink has been clicked or not. New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 27
  • 28. XP The Anchor Pseudo-Class Selectors • Using the anchor pseudo-class selectors, hyperlinks can be styled, based on the following four states: – a:link is the selector for normal links. – a:visited is the selector for visited links. – a:hover is the selector for the hover state (when the mouse pointer passes over the link). – a:active is the selector for active links (when a user holds down the mouse button to click a link). • Note that the colon does not have spaces before and after it. New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 28
  • 29. XP The Anchor Pseudo-Class Selectors + New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 29
  • 30. Setting Margins XP • The following properties are used to set margins: – margin-top – margin-right – margin-bottom – margin-left • Order is irrelevant. New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 30
  • 31. Setting Margins New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition XP 31