Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Dec 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how to handle DOCTYPE?

    hi friends h r u?
    i am in trouble, please help me out.
    ------------------------------
    when ever i try to include this
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    on top of my page it disturbs the whole site css and design issues.
    -------------------------------
    thanx in advance

  • #2
    New Coder
    Join Date
    Nov 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is the doctype i use

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">

    and it works fine.


    Some of the newer browsers need this new doctype to read properly (at least thats what Ive been told).

  • #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    The STRICT DOCTYPE would be a better choice than the TRANSITIONAL one. Transitional is only there to allow you to add DOCTYPEs to old pages that contain tags that used to be needed but which have been replaced by something better.

    If adding a DOCTYPE messes up your page in Internet Explorer then it means that your page was already messed up in all other browsers since adding the DOCTYPE tells IE to display the page the way other browsers do. Not that IE matches exactly to the output that real web browsers do without a few special IE only tweaks. Which is why you should check the page in other browsers first until you get it right and then tweak it for IE7 and then tweak it a lot more for IE6. (you can put the tweaks inside IE conditional comments so that only the browsers they are intended for will read them).
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #4
    Regular Coder croatiankid's Avatar
    Join Date
    Jan 2006
    Posts
    665
    Thanks
    1
    Thanked 12 Times in 12 Posts
    Quote Originally Posted by felgall View Post
    The STRICT DOCTYPE would be a better choice than the TRANSITIONAL one. Transitional is only there to allow you to add DOCTYPEs to old pages that contain tags that used to be needed but which have been replaced by something better.
    I disagree. You can't use HTML to open links in new windows using the STRICT DOCTYPE, since it doesn't support the A's TARGET attribute

  • #5
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    when ever i try to include this
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    on top of my page it disturbs the whole site css and design issues.
    A doctype is nothing more than a reference for the browser to describe the type of language you plan on using… sorta like a dictionary for code. If you code your design without a doctype, or using a transitional doctype, the browser interprets what you code as well as it can; if you use a Strict doctype, the browser tends to follow the rules laid out for it in the doctype.

    You can't use HTML to open links in new windows using the STRICT DOCTYPE, since it doesn't support the A's TARGET attribute
    Not true… you can, it just won't validate.

  • #6
    Regular Coder
    Join Date
    Mar 2005
    Location
    D0u$h!t3 k4?
    Posts
    512
    Thanks
    2
    Thanked 5 Times in 5 Posts
    You could always use your own things, like XHTML 1.1 is module-based. Extend the definition of the element to allow for the target attribute. From what I've heard, it won't validate, but it is technically valid.
    PHP Code:
    $hello file_get_contents('hello.txt'); echo $hello
    hello

  • #7
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    Opening a new window is a behaviour and not content.

    There are three languages for defining a web page.

    1. HTML defines the content
    2. CSS defines the appearance
    3. Javascript defines the behaviour

    That is why the target attribute was deprecated - because it should be done using Javascript and not HTML.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •