search

Home  >  Q&A  >  body text

javascript - What is the difference between style tag written after body and before body

What is the difference between writing the style tag after the body and before the body?

習慣沉默習慣沉默2754 days ago1441

reply all(6)I'll reply

  • 巴扎黑

    巴扎黑2017-05-19 10:28:04

    Written in the head tag to facilitate progressive rendering by the browser (resources downloading->CSSOM+DOM->RenderTree(composite)->Layout->paint). For the specific rendering process, please refer to
    http://blog.csdn.net/wozaixia...
    Written after the body tag. Since the browser parses the HTML document line by line, when it parses the style sheet written at the end (external (coupled or written in the style tag) will cause the browser to stop the previous rendering and wait for the loading and parsing of the style sheet to be completed before re-rendering. FOUC may occur under IE in Windows (that is, the page flickering problem caused by style failure)

    reply
    0
  • 大家讲道理

    大家讲道理2017-05-19 10:28:04

    Written at the end is to load the body first and then the style - what difference can there be? .

    reply
    0
  • 世界只因有你

    世界只因有你2017-05-19 10:28:04

    Writing it at the back may cause FOUC, it is better to write it at the front

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-19 10:28:04

    Loading order, the front is loaded before the body, the last is loaded after the body is loaded, and then loaded

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-05-19 10:28:04

    This is related to the browser crawler. The crawler enters the HTML mode when loading the page. If it is written before the body, the page has not started to be displayed, and the page white screen effect will not appear; if it is written after the body, when crawling to the css code, the crawler enters the css. mode, a white screen may appear.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-05-19 10:28:04

    Generally, styles are placed between the heads. If the style is placed at the bottom. It loads the tags and renders the styles. If it loads slowly, you'll see it dance.

    reply
    0
  • Cancelreply