Is <link> (not rel=“stylesheet”) allowed to be used in <body>?

后端 未结 7 528
情书的邮戳
情书的邮戳 2020-12-07 20:24

The new schema.org by Google, Yahoo and MS recommends usage of the attribute to display the status of products in an online shop:

&         


        
7条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-07 20:59

    To make sure the code is cross-browser compatible, rather include your stylesheet like this:

    
    

    Putting a stylesheet in the body is usually considered bad practice, however it can be helpful in some cases:

    1. You want the style to be loaded prior to other elements
    2. If you include certain frequently occuring website's elements (a contact box, a menu header, etc) by php, you can put the link to the corresponding stylesheet into the php template. Once you include the template, the stylesheet will be automatically loaded without having to add anything to the head section.

提交回复
热议问题