Grow your CSS skills. Land your dream job.

doctype

  • # May 9, 2012 at 5:46 am

    if we didnt use doctype in a html document what are the difficulties we will face? why we have to use doctype

    # May 9, 2012 at 6:51 am

    That’s like asking, if you didn’t use a windshield in your car, what are the difficulties you will face….?

    Why WOULDN’T you? Really, every page needs one. Without it, you’ll confuse browsers.

    # May 9, 2012 at 7:18 am

    Bottom line is without one that runs in standards mode you will face a long road of getting things to work properly in IE.

    # May 9, 2012 at 7:21 am

    The difficulties you will face is that HTML and CSS implementations have changed over the years. DOCTYPE tells the browser which implementation you have designed your website with, and therefore how it should render your page content. Without a DOCTYPE, browsers will revert to default.

    For some, like Opera, the browser will render it in the up-to-date format, so if you are using modern standards, Opera users will see it fine. Others, will not be so generous. You run the risk of falling into “Quirks” mode — a legacy of a bygone era where web designers wrote websites for specific browsers instead of to the specifications (note, the specifications weren’t as well documented as they are today). Many browsers will assume that a page without a DOCTYPE is one of these old fashioned pages, and will render it the way those designers would have expected.

    Given the lack of effort needed, just use < !DOCTYPE html> and be done with it.

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

You must be logged in to reply to this topic.

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