CS134 Web Design - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

CS134 Web Design

Description:

em h2 Bold and italic /h2 /em Block-level element/tag. define a complete section or block ... a (anchor tag), em, strong, img, q (short quotation) Attribute ... – PowerPoint PPT presentation

Number of Views:126
Avg rating:3.0/5.0
Slides: 21
Provided by: WSE976
Category:
Tags: cs134 | design | em | web

less

Transcript and Presenter's Notes

Title: CS134 Web Design


1
CS134 Web Design Development
  • Attributes, Lists, Tables,
  • Links, and Images
  • Mehmud Abliz

2
Block-Level vs. Inline Elements
  • This works
  • lth2gtltemgtBold and italiclt/emgtlt/h2gt
  • How about this
  • ltemgtlth2gtBold and italiclt/h2gtlt/emgt
  • Block-level element/tag
  • define a complete section or block of text
  • Can contain inline element and block-level
    element
  • Inline elements
  • Define the structure of a sequence of characters
    within a line
  • may not contain a block-level element
  • may be used within a block

3
Block-Level vs. Inline Elements
  • Partial list of block-level tags
  • p, blockquote, h1 h6, div, ul, ol, li, table,
    tr, td, th
  • Partial list of inline tags
  • a (anchor tag), em, strong, img, q (short
    quotation)

4
Attribute
  • An attribute is a special code that can enhance
    or modify a tag. They are generally located in
    the starting tag after the tag name.
  • Basic syntax for xhtml tags and attributes
  • lttag attribute"value"gt   lt/taggt
  • All tags must be lower case
  • all values of attributes need to be surrounded by
    quotes

5
Common Attributes
  • id
  • unique identifier for elements
  • class
  • the class of the element, used to specify similar
    attributes for dissimilar elements by putting
    them in the same class
  • style
  • an inline style definition
  • title
  • a text to display in a tool tip

6
Common Attributes
  • Examples 1
  • ltp idfirstParag classindent titleThis
    paragraph introduces html attributesgt
  • Assuming style sheet contains
  • .indent margin-right 5 margin-left 5
  • Example 2
  • ltp idfirstParag stylemargin-right 5
    margin-left 5 titleThis paragraph
    introduces html attributesgt

7
Common Attributes
  • lang
  • sets the language code en English, fr
    French, es Spanish, de German etc.
  • dir
  • sets the text direction, left to right or right
    to left
  • ltp langfr dirltrgtbonjour!lt/pgt
  • accesskey
  • assigns an access key to an element. An access
    key is a single character from the document
    character set.
  • tabindex
  • Sets the tab order of an element

8
Deprecated Attributes
  • In order to separate structure from presentation
  • many HTML attributes/tags used for presentation
    were deprecated, starting from HTML version 4
  • Some deprecated attributes
  • font, ltfont size5 colorredgtTextlt/fontgt
  • align, ltp aligncentergtCentered textlt/pgt
  • bgcolor, width, height, etc.

9
Lists
  • Ordered lists Unordered lists
  • ltolgt for ordered
  • ltulgt for unordered
  • ltligt for each item inside the list
  • Browser inserts a blank line before after the
    list (block-level element)
  • Example
  • ltolgt ltligtItem 1lt/ligt ltligtItem 2lt/ligt
    ltligtItem3lt/ligt lt/olgt

10
Lists
  • Nested lists
  • ltulgt
  • ltligtTop Level, Item 1lt/ligt
  • ltligtTop Level, Item 2
  • ltulgt
  • ltligtSublevel 1, Item 1
  • ltulgt
  • ltligtSublevel 2, Item 1lt/ligt
  • ltligtSublevel 2, Item 2lt/ligt
  • lt/ulgt
  • lt/ligt
  • ltligtSublevel 1, Item 2lt/ligt
  • lt/ulgt
  • lt/ligt
  • ltligtTop Level, Item 3lt/ligt
  • lt/ulgt

11
Customizing List Display
  • List numbers or marks can be customized
  • type attribute
  • Example
  • ltul typesquaregt
  • ltol typeAgt
  • ltol typeagt
  • ltol typeIgt
  • ltol typeigt
  • type attribute is not allowed in XHTML 1.0
    Strict, so use style sheets instead

12
Definition Lists
  • ltdlgt for list element ltdtgt for definition
    terms ltddgt for definition data
  • Example
  • ltdlgtltdtgtltstronggtCPUlt/stronggtlt/dtgtltddgtCentral
    Processing Unitlt/ddgtltdtgtltstronggtALUlt/stronggtlt/dtgt
    ltddgtArithmetic Logic Unitlt/ddgtltdtgtltstronggtGHzlt/s
    tronggtlt/dtgtltddgtGigahertzlt/ddgtlt/dlgt

13
Tables lttablegt
  • Tables used not only for displaying data in
    tabular format
  • A table (lttablegt) in HTML
  • Consists of rows (lttrgt)
  • Each row consists of rectangular boxes called
    cells (lttdgt)
  • lttablegtlttrgtlttdgtR1,Cell1lt/tdgtlttdgtR1,Cell2lt/tdgtlt/tr
    gtlttrgtlttdgtR2,Cell1lt/tdgtlttdgtR2,Cell2lt/tdgtlt/trgtlt/ta
    blegt

14
Tables
  • By default
  • Text in each cell is automatically aligned to the
    left
  • All the cells in a column have the same width
  • Width of the column is determined by the cell
    with the most text in it
  • ltthgt for table headerlttrgt ltthgtHeader1lt/thgt ltt
    hgtHeader2lt/thgtlt/trgt

15
Tables
  • Other attributes of lttablegt
  • align, cellpadding, cellspacing, colspan
  • Yet XHTML 1.0 Strict dont allow this attributes,
    so use stylesheet instead
  • Other tags
  • ltcaptiongt
  • ltcolgroupgt
  • lttheadgt, lttfootgt, lttbodygt

16
Links
  • The true power of WWW comes with hyperlinks
  • Surfer click on a specially marked word or image
    on a web page and automatically be jumped to
    another web page or another place in the same web
    page.
  • Another web page External link
  • Another place Internal link
  • Use ltagt (anchor) tag to create a link

17
Links
  • External Links
  • lta hrefSomeURLgtText/imagelt/agt
  • Create a link to CS web page
  • lta hrefhttp//www.cs.pitt.edu/gtCS Department
    at Pittlt/agt
  • Be careful about the quotation mark
  • Internal Links Create a place/anchor
  • lta idSomeLabelgtlt/agt or lta idSomeLabel
    nameSomeLabel/gtlt/agt
  • Link to the anchor
  • lta hrefSomeLabelgtGo to some placelt/agt

18
Links
  • Combining External and Internal Links
  • lta hrefSomeURLSomeLabelgtLink Textlt/agt

19
Images ltimggt
  • Insert an image using ltimggt tag
  • ltimg srcURL of the image file /gt
  • Image can an image on a remote machine on the
    Internet, or an image in your local machine.
  • Examples,
  • ltimg src"http//www.cs.pitt.edu/mehmud/gallery/n
    ature/images/Desert_and_Blue_Sky.jpg"/gt
  • ltimg src"../images/Lake_Karakul.jpg" /gt

20
Images
  • Alternative Text for images
  • ltimg srcImage URL altAlternative Text /gt
  • Example
  • ltimg src"../images/Lake_Karakul.jpg" alt"Lake
    Karakul"/gt
  • width height attributes
  • ltimg src"../images/Lake_Karakul.jpg" alt"Lake
    Karakul" width"257" height"161" /gt
  • Use style sheet instead of attributes, even
    though XHTML 1.0 Strict supports these two
    attributes
Write a Comment
User Comments (0)
About PowerShow.com