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.

Don't talk about CSS before you know what is the document type.

Discussion in 'CSS' started by justinlorder, Jul 16, 2008.

  1. #1
    I am always being asked the question why my Css doesn't work.
    Well, I had a tough experience learning css and at last a bit good at it.

    The most common question the css beginner should learn is the document type.
    Why? because the same css and html code dispay differently in different document type.
    I sometimes enconter people give out their html code and ask why the css doesn't work as follow.
    their html code begin with "<html>" , completely missing the document type.
    How can the browser know what document type is and display the right CSS , layout.


    All the document types are listed below.
    General speaking , some advance Css could only be support by strict type documents and Xhtml documents.


    You could also create the documents in Dreamweaver.
    File >> new document >> then at the right bottom of the option you can choose the document type.


    refer the the picture.
    in attachment file.

    html transitional document type

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>

    html strict document type

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>

    xhtml transitional document type

    <!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">


    xhtml strict document type

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


    xhtml 1.1 document type

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

    Remember each time when talking about CSS and why css doesn't work. The first thing to consider is the document type. It is definitely important.
     

    Attached Files:

    justinlorder, Jul 16, 2008 IP
    nicangeli likes this.
  2. nicangeli

    nicangeli Peon

    Messages:
    828
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Thats a pretty nice post. Thanks for adding it to the community. I hope that lots of people starting to learn CSS and HTML will read this.
     
    nicangeli, Jul 20, 2008 IP
  3. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Agreed. ++
     
    Stomme poes, Jul 21, 2008 IP