CSS - Mozilla bug? box-shadow:inset not working properly

后端 未结 3 1005
遥遥无期
遥遥无期 2021-01-12 10:23

Basically the below code should simply be a white page with a shadow around the edge. This works fine in Chrome but I can\'t seem to get it to work in Firefox!



        
3条回答
  •  别那么骄傲
    2021-01-12 10:56

    Add this:

    html, body {
        height: 100%
    }
    

    http://jsbin.com/oyuzug

    There is nothing in body, so it has no height.

    The only reason it worked without this in Chrome is because you did not include a doctype as the very first line to enable Standards Mode.

    Test these in Chrome:

    Your original code: http://jsbin.com/urimah

    Your original code with doctype: http://jsbin.com/urimah/2

    Conclusion: Always include a doctype as the very first line to avoid Quirks Mode and the inconsistencies it brings between different browsers.

提交回复
热议问题