Grow your CSS skills. Land your dream job.

Semantics?

  • # November 16, 2011 at 9:15 pm

    Just out of curiosity, which of the following is normally considered more semantic?




    heading number 1




    heading number 2




    heading number 3




    Or

    heading number 1

    heading number 2

    heading number 3

    # November 16, 2011 at 9:23 pm

    ….it’s the same exact markup.

    # November 16, 2011 at 9:30 pm

    Chris is right, it’s the exact same markup so neither would be considered ‘more’ semantic than the other. In terms of preference, though, mine would look something like this:



    heading number 1



    heading number 2



    heading number 3




    # November 16, 2011 at 9:34 pm

    The first option is more readable. Semantics is related to the elements used and both examples are using the same elements. I, like @TheDoc, would have markup looking like this:


    heading number 1


    heading number 2


    heading number 3



    # November 16, 2011 at 11:06 pm

    White space doesn’t affect semantics outside tags. Inside tags it usually only accepts two spaces and anything more than that still only accounts for two, unless you add  ’s or something of that nature. The white space could affect file size though. And also if you are importing .txt files into Flash and other odd cases white space will affect the outcome.

    I mark mine up just like @joshuanhibbert showed.

    # November 17, 2011 at 9:15 am

    Hmmm… I’d always thought that semantics was the “readability” of the code. After seeing the above, why are semantics such a big deal if the only people ever reading it is you, and a computer?

    # November 17, 2011 at 10:04 am

    Good question. Too many stress over it but really it’s not as important as some advocate.

    # November 17, 2011 at 2:50 pm

    I don’t necessarily agree with this article, however it was interesting to read:

    Our Pointless Pursuit Of Semantic Value

    # November 17, 2011 at 4:24 pm

    @cnwtx Semantics matter for those that may not be as fortunate as us. Accessibility is always something that should be on your mind and a sound semantic structure helps screen readers and therefore those that use screen readers.

    Rob
    # November 18, 2011 at 6:41 am

    Make it readable – make good and useful comments where needed so when you come back after a few other projects you can know why the heck you decided to do something. As long as you stick to that idea, anything is good :)

    # November 18, 2011 at 9:34 am

    @Robskiwarrior: Agreed!

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".