What is the css / html `root` element?

后端 未结 6 1754
Happy的楠姐
Happy的楠姐 2020-12-30 20:18

I have just recently started using NetBeans IDE (6.9.1) and have used it to add a stylesheet to my site-in-progress.

To my surprise, one element was automatically ad

6条回答
  •  庸人自扰
    2020-12-30 21:18

    From here: http://www.quirksmode.org/css/root.html

    The :root pseudo-element selects the root of all blocks in the page, ie. the Initial Containing Block. In HTML this is obviously the element

    Test stylesheet:

     :root {    
         background-color: #6374AB;
        padding: 50px; 
     } 
    

    If the :root selector works the left and right column of the page are blue, and the white middle column is offset by 50 pixels.

提交回复
热议问题