Is it necessary to declare type attribute in style tag

Discussion in 'HTML & Website Design' started by vinoth.t, Dec 27, 2009.

  1. #1
    Hi,
    Is it necessary to declare type attribute in style tag.
    <style>
    </style>
    or
    <style type="text/css">
    </style>
     
    vinoth.t, Dec 27, 2009 IP
  2. abhijit

    abhijit Notable Member

    Messages:
    4,094
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    215
    #2
    no.........................it is not necessary to declare ...........any.........attribute but...............if you can declare then it will be beneficial for you ................because some browser recommend it..................
     
    abhijit, Dec 27, 2009 IP
  3. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #3
    Yes, it is required. It may work without it but it is required.
     
    drhowarddrfine, Dec 28, 2009 IP
  4. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #4
    It is required in HTML4.01 Strict and XHTML1.0 Strict doctypes,
    but I was surprised to see that it's NOT required for HTML5. So, depends on your doctype.

    I guess they figure no other types are used. However, I have seen somewhere a Javascript type attribute... I'm not sure why.
    <style type="text/javascript">
    some stuff...
    </style>

    It might not even have been valid.
     
    Stomme poes, Dec 28, 2009 IP