开发者

How do i add border in all four side of browser page

How do i add border in all开发者_如何学Python four side of browser page no matter what browser, whatever resolution. Is there any such css or javascript code ?


If you want border around viewport you can try the following:

<html>
<head>
  <style>
  body {position: fixed; top:0; left: 0; bottom: -5px; right: -5px; 
        border: 5px solid red;}
 </style>
</head>
<body>
</body>
</html>

Depending on what you want exactly even better might be to use something as YUI Layout Manager.


Write the following lines in your CSS:

body {
  border-width: 5px; /* or what you want */
  border-style: solid;
  border-color: red; /* or what you want */

  /* or use the short form: */
  border: 5px solid red;
}


<body style="margin:0px;margin-right:2px;margin-bottom:2px">
<div style="width:100%;height:100%;border:1px solid red;margin-right:-2px;margin-bottom:-2px">
    Stuff here
</div>
</body>

In my opinion it is better solution than elektronikLexikon's, because height is always 100%.

EDIT: Height is fine now.

EDIT2: I like jira's answer even more than mine ;)

PS. Request always the best answer, not that which meets only few requirements. I couldn't make it on time.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜