Question about XHTML Strict

Discussion in 'HTML & Website Design' started by navi, Sep 26, 2008.

  1. #1
    I usually use XHTML Transitional but I am looking into switching over to XHTML Strict.

    First question: what are the benefits of using strict?

    I was looking at a list comparing the two:

    http://www.zvon.org/xxl/xhtmlReference/Output/comparison.html

    where it says

    I am a little confused here. I always use a <br /> to clear floats. Is that not correct? What am I supposed to do instead?

    I don't use the clear inline. I always define a class called

    .clear {
    clear:both;
    }

    and then clear by writing

    <br class="clear" />

    Is this also improper use of clear or is it just

    <br class="clear" />

    that is not allowed?
     
    navi, Sep 26, 2008 IP
  2. astoever

    astoever Peon

    Messages:
    65
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I've never had any problems with validation using <br class="clear" /> in strict. There might be some issues using them within certain elements though (as strict gets mad about ugly semantics in certain block tags like <form>).

    But:
    http://validator.w3.org/check?uri=http%3A%2F%2Fbinaerpilot.no%2F;
    ^ uses br clears and validates.
     
    astoever, Sep 26, 2008 IP
  3. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #3
    If the validator called "clear" an attribute, it's a good bet you missed a quote or something. When posting a question like this, be sure to quote the actual error message you got, and if possible, a link to the page, or at least the surrounding markup.

    cheers,

    gary
     
    kk5st, Sep 26, 2008 IP
  4. rochow

    rochow Notable Member

    Messages:
    3,991
    Likes Received:
    245
    Best Answers:
    0
    Trophy Points:
    240
    #4
    Why you'd use a clearing <br /> anyway...
     
    rochow, Sep 26, 2008 IP
  5. xira

    xira Active Member

    Messages:
    315
    Likes Received:
    8
    Best Answers:
    4
    Trophy Points:
    68
    #5
    XHTML Strict is "cleaner" code. A number of tags aren't allows and limited properties on the ones that are allowed. The advantage is, the code works in all browsers without any conflicts (although in FF there is an issue with images getting a 1px border that doesn't happen in Trans.) Using strict is mostly for providing super clean code to programmers who put it in different CMS software.
     
    xira, Sep 27, 2008 IP
  6. astoever

    astoever Peon

    Messages:
    65
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I usually:

    img { line-height:0; }

    To fix the extra FF picture-margin.
     
    astoever, Sep 27, 2008 IP
  7. Divisive Cottonwood

    Divisive Cottonwood Peon

    Messages:
    1,674
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I don't think that there is hardly any difference between transitional and strict

    I'm pretty sure that the "target" attribute for links isn't part of strict
     
    Divisive Cottonwood, Sep 27, 2008 IP
  8. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145
    #8
    I stay with transitional unless it's something like an FAQ page where the content likely isn't going to ever include user input.

    Strict is extremely tough to work with outside of a really basic context. I tried sticking with strict for months before finally just going with transitional instead.
     
    joebert, Sep 27, 2008 IP
  9. rochow

    rochow Notable Member

    Messages:
    3,991
    Likes Received:
    245
    Best Answers:
    0
    Trophy Points:
    240
    #9
    What is hard with strict? (specific examples of things that don't work or whatever)
     
    rochow, Sep 27, 2008 IP
  10. navi

    navi Peon

    Messages:
    80
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    http://www.zvon.org/xxl/xhtmlReferen...omparison.html
     
    navi, Sep 28, 2008 IP
  11. justinlorder

    justinlorder Peon

    Messages:
    4,160
    Likes Received:
    61
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Attribute clear is forbidden on br. << That is wrong. It is allowed .
     
    justinlorder, Sep 28, 2008 IP
  12. navi

    navi Peon

    Messages:
    80
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    What do you use instead to clear a float?
     
    navi, Sep 28, 2008 IP
  13. navi

    navi Peon

    Messages:
    80
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Really. Interesting. Thanks. Good to know.

    OT: Found your site and listening to your music right now. Cool. And I think your distribution method (TPB) really is the way to go. :)
     
    navi, Sep 28, 2008 IP
  14. navi

    navi Peon

    Messages:
    80
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Again, thanks. Just proves one shouldn't believe everything you read on the the internet. :)

    Anyone who can tell any practical reasons for using strict instead of transitional XHTML? I know it is "cooler" but why is it "better"?
     
    navi, Sep 28, 2008 IP
  15. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145
    #15
    Anything where content will be edited by more than one person.
    For instance, blog or forum posts.
    While in a perfect world, everyone would be able to code by hand and know how make everything work in strict, that's just not how it works. It's easier and more efficient to accomidate everyone with a transitional DOCTYPE than it is to teach everyone to use strict guidelines.
    I spent a couple of years preaching strict DOCTYPEs untill I actually tried to get them to work with sites I wasn't the sole contributer on.

    Anything where services from a 3rd party website might be used.
    I had a big problem on website where the site owner insisted on using the output from a 3rd party site to display the status of his game server. The template was originally designed to use strict but ultimately had to be switched to transitional to support <iframe>s.
    It was either that or bog his server down with PHP requests and cacheing.

    There's also things like Paypal button forms.
    For instance the last site I made would validate as strict if I wrapped the <form>s childeren in a container.
    That means I would have to add an extra element just so the page would validate as strict, when it validates perfectly fine without the container as transitional.
     
    joebert, Sep 28, 2008 IP
  16. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #16
    kk5st, Sep 28, 2008 IP
  17. astoever

    astoever Peon

    Messages:
    65
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #17
    Cheers mate!
     
    astoever, Sep 28, 2008 IP
  18. navi

    navi Peon

    Messages:
    80
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #18
    Click on the original link and you will get to the page
     
    navi, Sep 28, 2008 IP
  19. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #19
    I suggest you depend on the original (w3.org) source rather than derivative references. See annotated xhtml1.0 DTD, in particular, this bit:
    <!ELEMENT br EMPTY>   <!-- forced line break -->
    <!ATTLIST br
      %coreattrs;
      clear       (left|all|right|none) "none"
      >
    Code (markup):
    Such a blatant error makes zvon.org's credibility suspect.

    cheers,

    gary
     
    kk5st, Sep 28, 2008 IP
  20. navi

    navi Peon

    Messages:
    80
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #20
    Gary, you are right. I can be a bit lazy sometimes. The w3 page actually requires me to think. :)
     
    navi, Sep 29, 2008 IP