Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Type attribute of script and style ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 409
    Comment on it

    Hello Readers,

    Probably sometimes you see it when you use internal CSS, internal JS or in link text, and you are not if you are not using this (eg.- type="text/css"), also your script and CSS works.

    So why we need this?

    In the post will discuss the type attribute for script and style what is that and really we need it, huh.

     

    What is type attribute of script and style or what is content-type ?

    <style type="text/css"></style>
    <script type="text/javascript"></script>

     

    The type attribute is actually required for HTML 4.01 , this content-type is demarcated for the HTTP response

    <link rel="stylesheet" type="text/css" href="path">

    This defines what content you write and use as a hint to user agents. If you do not write this (in html4) then it can be a possibility that your code gives you a bad response.

    is it necessary ?

    Yes, If you are using html4 only then but nowadays as you know html5 is in the extreme and html5 have dropped this feature.

    So, in html5 you have no need of content type :)

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: