开发者

border and background of html tag

开发者 https://www.devze.com 2023-02-19 18:47 出处:网络
html { margin:0; padding:0; background-color:#006600; border-style:solid;} /*Dark Green*/ body { margin:0; padding:0; background-color:#660000; border-style:dotted; } /*Dark Brown*/
html { margin:0; padding:0; background-color:#006600; border-style:solid;  } /*Dark Green*/
body { margin:0; padding:0; background-color:#660000; border-style:dotted; } /*Dark Brown*/

<html>
   开发者_运维知识库 <body>
      test
    </body> 
</html>

Why does the background-color of html tag extend the full window but the border-style of the tag remain confined just outside the body box border.


Specifying the right amount of height and width should solve your problem.
Try it with appropriate values of height and width.


See this link : Understanding the HTML versus BODY Element in CSS

The html and body elements are distinct block-level entities, in a parent/child relationship.
The html element's height and width are controlled by the browser window.

The body element is (by default) position:static, which means that positioned children of it are positioned relative to the html element's coordinate system.

In almost all modern browsers, the built-in offset from the edge of the page is applied through a margin on the body element, not padding on the html element.

Hope you get some idea to your doubt.

0

精彩评论

暂无评论...
验证码 换一张
取 消