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 11Jeff Byrnes
 
Castro Chapter 10
Castro Chapter 10Castro Chapter 10
Castro Chapter 10Jeff Byrnes
 
Castro Chapter 9
Castro Chapter 9Castro Chapter 9
Castro Chapter 9Jeff Byrnes
 
Castro Chapter 8
Castro Chapter 8Castro Chapter 8
Castro Chapter 8Jeff Byrnes
 
Castro Chapter 7
Castro Chapter 7Castro Chapter 7
Castro Chapter 7Jeff Byrnes
 
Castro Chapter 5
Castro Chapter 5Castro Chapter 5
Castro Chapter 5Jeff Byrnes
 
Castro Chapter 2
Castro Chapter 2Castro Chapter 2
Castro Chapter 2Jeff Byrnes
 
INFO 3775 Chapter 2 Part 1
INFO 3775 Chapter 2 Part 1INFO 3775 Chapter 2 Part 1
INFO 3775 Chapter 2 Part 1Jeff Byrnes
 
Castro Chapter 2
Castro Chapter 2Castro Chapter 2
Castro Chapter 2Jeff 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

ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 

Recently uploaded (20)

ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 

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>