CSS Knowledge

  • What is CSS
  • External CSS

  • CSS Table
  • CSS span
  • CSS a
  • CSS input
  • CSS HR
  • CSS align
  • CSS LI
  • CSS ul
  • CSS width
  • CSS overflow
  • CSS justify
  • Css Two Column
  • Css blockquote

  • CSS flash
  • More others

    Javascript
    CSS
    PHP

     

    CSS span


    The <span> tag has very similar properties to the <div> tag, in that it affects the style of the text it encloses. Items in the <span> can be aligned or given specific style attributes.

    The primary difference between the <span> and <div> tags is that <span> doesn't do any formatting of it's own. The <div> tag acts as a paragraph break, because it is defining a logical division in the document. The <span> tag simply tells the browser to apply the style and align rules to whatever is within the <span>.

    The <span> tag has no required attributes, but the three that are the most useful are:

    • style
    • id
    • class

    Use <span> when you want to change the style of elements without naming them in a separate division within the document. For example, if you had a Level 3 Heading (<h3>) that you wanted the second word to be red, you could surround that word with

    <span style="color : #f00;">2ndWord</span>

    and it would still be a part of the <h3> tag as well, just red.

    <span> End Tag: </span> REQUIRED

    <span> Contents:

    Usually any HTML text that you want to specify a style for. The following tags are valid within the <span> tag:
    a, acronym, applet, b, basefont, bdo, big, br, button, cite, code, dfn, em, font, i, iframe, img, input, kbd, label, map, object, q, s, samp, script, select, small, span, strike, strong, sub, sup, textarea, tt, u, var

    <span> Valid Context:

    The <span> tag is valid within the following tags:
    a, acronym, address, applet, b, bdo, big, blockquote, body, button, caption, center, cite, code, dd, del, dfn, div, dt, em, fieldset, font, form, h1, h2, h3, h4, h5, h6, i, iframe, ins, kbd, label, legend, li, noframes, noscript, object, p, pre, q, s, samp, small, span, strike, strong, sub, sup, td, th, tt, u, var

    <span> Usage:

    • change style of text within a paragraph

    <p>This is a paragraph with <span style="color : purple; text-decoration : line-through;">one short phrase</span> in purple, and crossed out.</p>

    <span> Special Notes:

    • Unlike the div tag, you can use span within paragraph tags, but you can't use it to group block elements, like you can with the div tag.

     

     

     

     

     

     

     

     

     

     





















     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

  • Javascript |