SlideShare a Scribd company logo
1 of 10
LISTS
HTML5 & CSS Visual Quickstart Guide
Chapter 15
Lists in HTML
• HTML provides a way to create lists of items
• Plain lists
• Numbered lists
• Bulleted lists
• List of descriptions
• Also possible to nest one or more lists inside another one
• Lists formed by principal element to specify what sort of list you
create
• ul – Unordered list
• ol – Ordered list
• dl – Description list (formerly definition list)
• Secondary element specifies what sort of list item
• li for list item in ol or ul
• dt for term in dl
• dd for description in dl
Creating Ordered Lists
• Ordered list is useful for step-by-step instructions
• Also useful for creating an outline
• Also the proper choice for marking up breadcrumb
navigation
• Example:
<h1>Making a PB&J Sandwich</h1>
<ol>
<li>Get two slices of bread</li>
<li>Spread peanut butter on one slice</li>
<li>Spread jelly on the other slice</li>
<li>Put the two slices together</li>
</ol>
Creating Unordered Lists
• Unordered lists are most widely used lists on Web
• …because they’re used to mark up navigation
• Also useful for lists of features, parts lists, etc.
• Example:
<h1>What You Need for a PB&J Sandwich</h1>
<ul>
<li>2 slices of bread</li>
<li>Peanut Butter</li>
<li>Jelly</li>
<li>Butter knife</li>
<li>Spoon</li>
</ul>
Choosing Your Markers
• You can choose what sort of markers appear to the left of each
list item
• Bullets
• Numbers
• Images
• Do this via CSS property list-style-type: marker
• marker can be one of the following:
• disc
• circle
• square
• decimal
• upper-alpha
• lower-alpha
• upper-roman
• none
Choosing Where to Start List Numbering
• By default, numbered list begins with 1
• Might want to start somewhere else, though
• Change this with start attribute on the ol tag
• <ol start=“3”> would start ordered list at 3
• You can also change numbering of a specific list item
• <ol start=“2”>
<li>Unscrew the old bulb</li>
<li value=“5”>Screw in the new bulb</li>
<li>Plug in the lamp and turn it on</li>
</ol>
Using Custom Markers
• Can create your own custom marker with an image
• Don’t have to change your HTML, just the CSS
• First, turn off normal markers
• Then, set background property for li elements to desired image
• ul {
list-style: none;
margin-left: 0;
padding-list: 15px;
}
li {
background: url(arrow-right.png) no-repeat 0
2px;
padding-list: 25px;
}
Controlling Where Markers Hang
• By default, lists are indented from left margin
• Markers can begin either halfway to the right of that point
(default) or flush with the rest of the text
• To make markers flush with the text:
li {
list-style-position: inside;
}
Setting All List-Style Properties at Once
• Can combine different list-style properties into one
• li {
list-style: inside circle;
}
Creating Description Lists
• Used for describing association between names (or
terms) and values in groups
• Previously called definition lists, now known as
description lists
• <h1>List of Horror Movie Legends</h1>
<dl>
<dt>Boris Karloff</dt>
<dd>Best known for his role in
<cite>Frankenstein</cite>, his real name
was William Henry Pratt.</dd>
<dt>Christopher Lee</dt>
<dd>Took a bite out of audiences as Dracula</dd>
</dl>

More Related Content

More from Jeff Byrnes

Castro Chapter 11
Castro Chapter 11Castro Chapter 11
Castro Chapter 11
Jeff Byrnes
 
Castro Chapter 10
Castro Chapter 10Castro Chapter 10
Castro Chapter 10
Jeff Byrnes
 
Castro Chapter 9
Castro Chapter 9Castro Chapter 9
Castro Chapter 9
Jeff Byrnes
 
Castro Chapter 8
Castro Chapter 8Castro Chapter 8
Castro Chapter 8
Jeff Byrnes
 
Castro Chapter 7
Castro Chapter 7Castro Chapter 7
Castro Chapter 7
Jeff Byrnes
 
Castro Chapter 5
Castro Chapter 5Castro Chapter 5
Castro Chapter 5
Jeff Byrnes
 
Castro Chapter 2
Castro Chapter 2Castro Chapter 2
Castro Chapter 2
Jeff Byrnes
 
INFO 3775 Chapter 2 Part 1
INFO 3775 Chapter 2 Part 1INFO 3775 Chapter 2 Part 1
INFO 3775 Chapter 2 Part 1
Jeff Byrnes
 
Castro Chapter 2
Castro Chapter 2Castro Chapter 2
Castro Chapter 2
Jeff Byrnes
 

More from Jeff Byrnes (9)

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 7
Castro Chapter 7Castro Chapter 7
Castro Chapter 7
 
Castro Chapter 5
Castro Chapter 5Castro Chapter 5
Castro Chapter 5
 
Castro Chapter 2
Castro Chapter 2Castro Chapter 2
Castro Chapter 2
 
INFO 3775 Chapter 2 Part 1
INFO 3775 Chapter 2 Part 1INFO 3775 Chapter 2 Part 1
INFO 3775 Chapter 2 Part 1
 
Castro Chapter 2
Castro Chapter 2Castro Chapter 2
Castro Chapter 2
 

Recently uploaded

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Recently uploaded (20)

Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
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
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
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
 

Castro Chapter 15

  • 1. LISTS HTML5 & CSS Visual Quickstart Guide Chapter 15
  • 2. Lists in HTML • HTML provides a way to create lists of items • Plain lists • Numbered lists • Bulleted lists • List of descriptions • Also possible to nest one or more lists inside another one • Lists formed by principal element to specify what sort of list you create • ul – Unordered list • ol – Ordered list • dl – Description list (formerly definition list) • Secondary element specifies what sort of list item • li for list item in ol or ul • dt for term in dl • dd for description in dl
  • 3. Creating Ordered Lists • Ordered list is useful for step-by-step instructions • Also useful for creating an outline • Also the proper choice for marking up breadcrumb navigation • Example: <h1>Making a PB&J Sandwich</h1> <ol> <li>Get two slices of bread</li> <li>Spread peanut butter on one slice</li> <li>Spread jelly on the other slice</li> <li>Put the two slices together</li> </ol>
  • 4. Creating Unordered Lists • Unordered lists are most widely used lists on Web • …because they’re used to mark up navigation • Also useful for lists of features, parts lists, etc. • Example: <h1>What You Need for a PB&J Sandwich</h1> <ul> <li>2 slices of bread</li> <li>Peanut Butter</li> <li>Jelly</li> <li>Butter knife</li> <li>Spoon</li> </ul>
  • 5. Choosing Your Markers • You can choose what sort of markers appear to the left of each list item • Bullets • Numbers • Images • Do this via CSS property list-style-type: marker • marker can be one of the following: • disc • circle • square • decimal • upper-alpha • lower-alpha • upper-roman • none
  • 6. Choosing Where to Start List Numbering • By default, numbered list begins with 1 • Might want to start somewhere else, though • Change this with start attribute on the ol tag • <ol start=“3”> would start ordered list at 3 • You can also change numbering of a specific list item • <ol start=“2”> <li>Unscrew the old bulb</li> <li value=“5”>Screw in the new bulb</li> <li>Plug in the lamp and turn it on</li> </ol>
  • 7. Using Custom Markers • Can create your own custom marker with an image • Don’t have to change your HTML, just the CSS • First, turn off normal markers • Then, set background property for li elements to desired image • ul { list-style: none; margin-left: 0; padding-list: 15px; } li { background: url(arrow-right.png) no-repeat 0 2px; padding-list: 25px; }
  • 8. Controlling Where Markers Hang • By default, lists are indented from left margin • Markers can begin either halfway to the right of that point (default) or flush with the rest of the text • To make markers flush with the text: li { list-style-position: inside; }
  • 9. Setting All List-Style Properties at Once • Can combine different list-style properties into one • li { list-style: inside circle; }
  • 10. Creating Description Lists • Used for describing association between names (or terms) and values in groups • Previously called definition lists, now known as description lists • <h1>List of Horror Movie Legends</h1> <dl> <dt>Boris Karloff</dt> <dd>Best known for his role in <cite>Frankenstein</cite>, his real name was William Henry Pratt.</dd> <dt>Christopher Lee</dt> <dd>Took a bite out of audiences as Dracula</dd> </dl>