Styling the `<html>` element in CSS?

前端 未结 6 1411
生来不讨喜
生来不讨喜 2020-12-08 10:01

Can anyone explain to me why can we style the element html?
What are differences between it and body?

I usually see tutorials and multi

6条回答
  •  青春惊慌失措
    2020-12-08 10:38

    Quite often you'll find people styling the HTML element since it does have an affect on the way the page is rendered.

    The most notable style you're likely to see is

    html,body{
       min-height:101%;
    }
    

    This is used to ensure that the scroll bars in browsers like Firefox, always show on the page. This stops the page shifting left and right when changing between long and short pages.

提交回复
热议问题