Web Analytics Made Easy -
StatCounter Any genius? Does <link> inside the <body> tag still require property="stylesheet"? - CodingForum

Announcement

Collapse
No announcement yet.

Any genius? Does <link> inside the <body> tag still require property="stylesheet"?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Any genius? Does <link> inside the <body> tag still require property="stylesheet"?

    For a long time when one used the W3C Validator it would return an error message saying that the <link> stylesheet tags were not allowed in the body. One had a work around by adding "property="stylesheet" and the error would go away.

    I no longer see this error being displayed in the results.

    Has HTML specs been revised to allow <link> to be inside the <body> tag without the property attribute?

    Love to get more details from a genius here.

  • #2
    Originally posted by corezz View Post
    For a long time when one used the W3C Validator it would return an error message saying that the <link>http://www.codingforum.net/ stylesheet tags were not allowed in the body. One had a work around by adding "property="stylesheet" and the error would go away.

    I no longer see this error being displayed in the results.

    Has HTML specs been revised to allow <link>http://www.codingforum.net/ to be inside the <body> tag without the property attribute?
    The WHATWG HTML spec allows link elements with a rel="stylesheet" attribute to appear within the body element; see https://html.spec.whatwg.org/multipa...s.html#body-ok.

    The W3C HTML 5/5.1/5.2 specs do not; see the HTML 5.2 editor’s draft at https://w3c.github.io/html/links.html#body-ok. The W3C specs don’t allow embedded or external stylesheets to be specified outside of the head element through any mechanism as far as I can tell.

    There is no property attribute per both specs.

    Comment


    • #3
      The <link> tag does not display anything in the browser and it doesn't need to run after the page has displayed so it makes no sense whatever to put it in the body.
      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.

      Comment


      • #4
        Originally posted by felgall View Post
        The <link>http://www.codingforum.net/ tag does not display anything in the browser and it doesn't need to run after the page has displayed so it makes no sense whatever to put it in the body.
        Actually there is a logical reason to put it in the body. It is used as a way to prevent render blocking. One of the more common techniques is to put css and js <link> in the footer inside body with only the bare minimum above-the-fold css in the <head> -- helping improve page rendering dramatically. Google recommends this practice, among many others. There are things like asyn and defer but it seems people like to put the <link> in the body .

        Comment


        • #5
          Originally posted by Arbitrator View Post
          The WHATWG HTML spec allows link elements with a rel="stylesheet" attribute to appear within the body element; see https://html.spec.whatwg.org/multipa...s.html#body-ok.

          The W3C HTML 5/5.1/5.2 specs do not; see the HTML 5.2 editor’s draft at https://w3c.github.io/html/links.html#body-ok. The W3C specs don’t allow embedded or external stylesheets to be specified outside of the head element through any mechanism as far as I can tell.

          There is no property attribute per both specs.
          Wow thanks very much @Arbitrator for the well thought out answer and links. Highly appreciated!

          Comment


          • #6
            Originally posted by corezz View Post
            It is used as a way to prevent render blocking. One of the more common techniques is to put css and js <link>http://www.codingforum.net/ in the footer inside body with only the bare minimum above-the-fold css in the <head>.
            In that case it would go at the very bottom of the body just before the <script> tag that is just before the </body> tag so that all of the non page content entries in the body are all together at the very bottom.
            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.

            Comment

            Working...
            X