1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

The problem with "definition lists" and aligning

Discussion in 'HTML & Website Design' started by tayiper, Dec 23, 2006.

  1. #1
    OK, I am really getting frustrated because of this. You see, after I've put the links on my website's index.html page info a "definition list" and validated it the document, came out of processing with no less than 218 errors, while previously it was a valid XHTML. The errors I was getting were basically of two kinds; one for a "div" element and one for a "br" element.


    The error-text for a "div" element:

    The error-text for a "br" element:

    Therefore I've first changed the order of "br" elements, namely I changed it from "</dd><br /><br /><dt><div class" to "</dd><dt><br /><br /><div class", and after validating it again, the error-count was reduced to 90 errors, and then after fixing some other stuff too (I don't remember exactly what it was) to 62 errors. Anyway, as you can see, this change in order of "br" elements completely fixed the second error quoted above, so I've ended up with only 24 errors total as you can see here: W3C Validator - index-test.html.

    But the problem with "div" elements remained nomather what I tried. For instance, I tried with replacing the "<div class="align2">" div class with inline "<div style="text-align: left">" variant, and later with "<span style="text-align: left">" (which surprisingly didn't move the text to the left) and so on and on. Then I remembered that I have one document from W3C stored on my hard-disk (namely the W3C - Lists in HTML documents one), and in it've read one thing that might be the reason/cause for my troubles.


    The text from that W3C document:

    So although I apparently see/understand what the effect of this is, I am really not sure what "restricted to inline content" and "block-level content" mean in this case (and in general too), and above all, how should I deal with it??!


    thanks, tayiper
     
    tayiper, Dec 23, 2006 IP
  2. Corey Bryant

    Corey Bryant Texan at Heart

    Messages:
    1,126
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Block level is basically a tag that will take up the entire line - like <p>, <div> or a header tag. Inline are like <span>, <a>, <em> etc.

    It seems the <dd> tag defines the description of a term in a definition list and the <dt> tag is placed inside the <dd> tag to define the start of a term in a definition list.
     
    Corey Bryant, Dec 24, 2006 IP
  3. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #3
    Close, Corey. The dt is the term. It may contain only inline elements. The dd is the definition and may contain anything. The dd is a sibling to dt. It is up to the author to order things so they make sense.

    cheers,

    gary
     
    kk5st, Dec 24, 2006 IP
  4. tayiper

    tayiper Active Member

    Messages:
    421
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    78
    #4
    Thanks both for your replies. Any idea on how could I then align those links to the left side?? /EDIT: Oh nevermind, I got an answer to that question in some other forum where I posted this same question.


    tayiper
     
    tayiper, Dec 24, 2006 IP
  5. roy77

    roy77 Active Member

    Messages:
    1,088
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    78
    #5
    i think you should change <br /> into <br> ???
     
    roy77, Dec 24, 2006 IP
  6. Corey Bryant

    Corey Bryant Texan at Heart

    Messages:
    1,126
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks Gary. I hardly mess with those but at least he got it working
    If the OP is using XHTML then it should be
    <br />
    Code (markup):
     
    Corey Bryant, Dec 24, 2006 IP
  7. tayiper

    tayiper Active Member

    Messages:
    421
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    78
    #7
    ... in particular in this Paul Jr's post on WebDeveloper.com forum (yeah, the answer was an easy/obvious one) if anyone is maybe interested.


    tayiper
     
    tayiper, Dec 25, 2006 IP