CSS, cont. - PowerPoint PPT Presentation

About This Presentation
Title:

CSS, cont.

Description:

span.chocolate { font-family: Times; color: #330; span Tag. HTML: ... chocolate-covered espresso beans /span span , cont. ... – PowerPoint PPT presentation

Number of Views:84
Avg rating:3.0/5.0
Slides: 14
Provided by: SarahM100
Category:
Tags: css | chocolate | cont

less

Transcript and Presenter's Notes

Title: CSS, cont.


1
CSS, cont.
  • October 7, Unit 4

2
Generic Containers
  • Currently, we know how to modify the properties
    of HTML tags using style sheets
  • But, we can only modify the tags and what they
    contain
  • Cant modify a group of tags as one
  • The generic containers, ltspangt and ltdivgt, allow
    us to group tags or words

3
Generic Containers, cont.
  • The generic container tags do absolutely nothing,
    until they are modified by attributes.
  • The ltspangt tag in an inline tag
  • Can modify the language (lang attribute), font
    color, font-family, font-style, etc.
  • The ltdivgt tag is a block-level tag
  • Allows us to group paragraphs together with
    lists, etc.
  • Can be used to create navigation bars

4
ltspangt Tag
  • The span tag is useful for applying attributes to
    some text
  • ex. I love chocolate-covered espresso beans
  • CSS
  • span.chocolate
  • font-family Times
  • color 330

HTML I love ltspan class chocolategt
chocolate-covered espresso beanslt/spangt
5
ltspangt, cont.
  • ltspangt can be contained within block-level and
    inline-level elements
  • The attributes of ltspangt are
  • id the id from the style sheet
  • class the class from the style sheet
  • lang language of the text
  • dir specifies the direction of text (ltr, rtl)

6
Using ltspangt
  • Span should not be used when there is an
    appropriate standard html tag
  • e.g do not use ltspangt to italicize text
  • Use the ltigt tag
  • The ltigt, ltbgt, ltemgt etc. also have attributes
  • Including ltstylegt, ltlanggt etc.
  • lti style color red font-family Couriergt
  • You do not have to specify a CSS rule to use span
  • I love ltspan style color 330 font-family
    Timesgt
  • chocolate-covered espresso beanslt/spangt

7
ltspangt, cont.
  • ltspangt should be used only to modify small
    portions of text
  • Do not use ltspangt to modify all of a paragraph
  • If you do need to use span, and will need the
    same modifications more than once or twice, add a
    class to your style sheet
  • Also helpful to use a style sheet so that you
    only have to modify a single file to change the
    way the document appears

8
ltdivgt Tag
  • Probably the most common use for the ltdivgt tag is
    for navigation bars
  • ltdivgt is a block-level tag (like a paragraph)
  • Can contain any number of block-level tags or
    inline tags
  • Can group paragraphs, with lists, with tables,
    e.g.

9
ltdivgt
  • ltdivgt tags will most often be used inside the
    ltbodygt tag and inside other ltdivgt tags
  • Can be nested
  • Often ltdivgt tags are modified using the id
    attribute, rather than class
  • You only have one navigation bar, e.g.
  • The properties you want for a certain portion of
    your page are unique

10
Simple Navigation Menu
  • CSS
  • divsidebar
  • floatleft
  • background-color ccf
  • width 10
  • HTML
  • ltdiv id sidebargt
  • ltulgt
  • ltligtItem1lt/ligt
  • ltligtItem2lt/ligt
  • ltligtItem3lt/ligt
  • lt/ulgt
  • lt/divgt

11
In Class Examples
  • Simple left-nav bar
  • Simple right-nav bar
  • Simple top nav bar
  • Combining top and side nav bars

12
When to Use Generic Containers
  • Generic containers are a sort of last resort
  • If you can get the look you want by using a
    regular html tag, you should
  • Can be modified using the class or id attribute
    and a style sheet
  • You should only use generic containers when there
    is no tag which fits the meaning of the content
  • e.g. There is no tag for navigation bars

13
Happy Thanksgiving!
Write a Comment
User Comments (0)
About PowerShow.com