Web Site Design and Development Lecture 10 CS 0134 Fall 2018 Tues - - PowerPoint PPT Presentation

web site design and development lecture 10
SMART_READER_LITE
LIVE PREVIEW

Web Site Design and Development Lecture 10 CS 0134 Fall 2018 Tues - - PowerPoint PPT Presentation

Web Site Design and Development Lecture 10 CS 0134 Fall 2018 Tues and Thurs 1:00 2:15PM Lists You can create unordered lists with ul and ordered lists with ol. An unordered list uses bullet points for each item by default. An


slide-1
SLIDE 1

Web Site Design and Development Lecture 10

CS 0134 Fall 2018 Tues and Thurs 1:00 – 2:15PM

slide-2
SLIDE 2

2

Lists

  • You can create unordered lists with ul and
  • rdered lists with ol.

– An unordered list uses bullet points for each

item by default.

– An ordered list uses numbers for each item

by default.

  • You can add items to ul or ol by using the li
  • element. The li element can contain text or
  • ther html elements.
slide-3
SLIDE 3

3

The start attribute

  • The ol element has an attribute named start
  • start can be used to start the ol at a position
  • ther than 1. For example, <ol start=”3”> will

create an ordered list that starts with 3 rather than 1.

  • If the ordered list is using letters rather than

numbers, start=”3” will start the list with C rather than A.

slide-4
SLIDE 4

4

Nested lists

  • You can place a list inside an li to create a nested list.

Code Browser

<ul> <li>List item 1</li> <li>List item 2 <ul> <li>List item 2 detail 1</li> <li>List item 2 detail 2</li> </ul> </li> </ul>

slide-5
SLIDE 5

5

Description lists

  • Another type of list that can be used is a description
  • list. A description list is made up of three elements

– dl: the dl element is used to create a description list – dt: the dt element is used to create a term to be described. The dt

element can only contain text and inline elements

– dd: the dd element is used to create a description for the

previously listed term. The dd element can contain block elements in addition to text and inline elements

  • You may see the word defjnition used instead of
  • description. This is because in HTML4, dl was called a

defjnition list.

slide-6
SLIDE 6

6

Description lists continued

  • You create a dl by grouping dt and dd

elements together as adjacent siblings.

  • You can have multiple dt for one dd and

you can have multiple dd for one dt.

slide-7
SLIDE 7

7

Description list example

Code <dl> <dt>p</dt> <dd>The paragraph element</dd> <dt>a</dt> <dd>The anchor element</dd> <dt>dl</dt> <dd>1. In HTML4, dl means defjnition list</dd> <dd>2. In HTML5, dl means description list</dd> </dl>

Browser

slide-8
SLIDE 8

8

Questions?

slide-9
SLIDE 9

9

Formatting lists

  • You can format lists with the list-style-type

and list-style-image as well as with margin and padding

slide-10
SLIDE 10

10

list-style-type

  • The list-style-type property defjnes the style used by the

list

  • For an unordered list, list-style-type will accept the

keywords disc, circle, square and none. Disc is the default

  • For an ordered list, list-style-type will accept the

keywords decimal, decimal-leading-zero, lower-alpha, upper-alpha, lower-roman and upper-roman. Decimal is the default

  • You can set the list-style-type on either the ul, ol or li

elements.

slide-11
SLIDE 11

11

list-style-type examples

  • list-style-type: circle;
  • list-style-type: none;
  • list-style-type: upper-roman;
  • list-style-type: decimal-leading-zero;
slide-12
SLIDE 12

12

list-style-image

  • The list-style-image property specifjes a

custom image to be used as a bullet point

  • list-style-image will accept a url() value
  • Example

– list-style-image: url(“smile-emoji.png”); – list-style-image: url(“frown-emoji.png”);

slide-13
SLIDE 13

13

Aligning list items

  • You can adjust how indented a list item is by setting

the padding-left property on ul or ol.

  • You can adjust the space between the bullet (or

number) and the text of a list item by setting the padding-left property on the li element.

  • You can adjust the vertical spacing for list items by

setting the padding-bottom property on the li element.

  • You can adjust how indented a description is in a

description list by setting the margin-left property on the dd element.

slide-14
SLIDE 14

14

Alignment examples

  • ul {

padding-left: 2em; }

  • li {

padding-left: 0.5em; padding-bottom: 0.5em; }

  • dd {

margin-left: 0; }

slide-15
SLIDE 15

15

Questions?