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
    Jul 2006
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation text/css and "text/css"

    i would like to know if <style type=text/css> & <style type="text/css"> is same , or does the " makes any difference?


    thx lots

  • #2
    Regular Coder googleit's Avatar
    Join Date
    Jul 2006
    Location
    birmingham, uk
    Posts
    189
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <style text="text/css">
    is valid html & css while the other isnt

  • #3
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    The other is valid but only in HTML. If you are using XHTML then its not valid.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #4
    Regular Coder Graft-Creative's Avatar
    Join Date
    Aug 2004
    Location
    Web Designer - North East Lancashire U.K.
    Posts
    842
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by _Aerospace_Eng_ View Post
    The other is valid but only in HTML. If you are using XHTML then its not valid.
    Code:
    <style text="text/css">
    ...is valid both in html and xhtml.

    Gary

  • #5
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    I was referring to the one without quotes which wouldn't be valid in XHTML.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #6
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,640
    Thanks
    0
    Thanked 649 Times in 639 Posts
    Best to include the quotes around the value of ALL attributes even in HTML as then the browser doesn't have to work out where the value ends and you avoid the possibility of having a browser interpret your value differently than you expected.

    Where something is optional in the HTML standard then good coding practice is to always include it unless there is a reason not to include it. eg. closing </p> tags are optional but your page will load slower if you don't include them, the title attribute is also optional but only needs to be included where you actually want to attach a tooltip (as when you don't need a tooltip there are benefits to not including the title attribute).
    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.

  • #7
    New Coder
    Join Date
    Jul 2006
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thx for the help , i will include the quote.


  •  

    Posting Permissions

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