0

我想知道是否可以仅在页面背景上圆角,例如 -

body{background-color:#7A991A;

所以我想围绕页面的每个角落?谢谢你

4

5 回答 5

3

您必须为html元素提供背景颜色:

html, body {
    height: 100%;
}
html { background: white }
body {
    background-color:#7A991A;
    border-radius: 20px;
}

这是小提琴:http: //jsfiddle.net/wYKa3/

于 2012-04-15T23:21:41.797 回答
1

你可以使用这个:

body{
-moz-border-radius:4px;
-webkit-border-radius:4px;
border-radius: 4px;
-moz-box-shadow:0 2px 2px rgba(0,0,0,0.3);
-webkit-box-shadow:0 2px 2px rgba(0,0,0,0.3);
box-shadow: 0 2px 2px rgba(0,0,0,0.3);
background:#7A991A;
}

这是一个带有圆角和阴影色角的背景。

于 2012-04-16T00:59:25.917 回答
0

您可能还想使用-webkit-border-radiusand -moz-border-radius,如下所示:

body {
    background-color:#7A991A;
    border-radius: 20px;
    -webkit-border-radius: 20px;
    -moz-border-radius: 20px;
}

增加与不同浏览器的兼容性。

于 2012-04-16T01:03:02.467 回答
0

你可以看到这个CSS与浏览器兼容级别:

    html, body {
    height: 100%;
    background: white
}

body {
-moz-border-radius:20px;
-webkit-border-radius:20px;
border-radius: 20px;
background:red;
}

演示:- http://jsfiddle.net/trzpK/

于 2012-04-16T06:39:20.570 回答
-1

我不认为这是可能的。既然“正文”是整个文档,那么如果你把页面的角落弄圆,下面应该出现什么?

也许您可以将页面内容包装在<div>具有全宽和全高的元素中,然后在其上设置圆角而不是 body。然后你将 body 的背景设置为与全尺寸 div 不同的颜色,然后你就设置好了。像这样的东西应该工作:

HTML:

<body>
  <div id="content">
    <!-- Your content here -->
  </div>
</body>

CSS:

body { background-color: #000000; }
#content { 
  width: 100%; 
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background-color: #ffffff;
  border-radius: 10px;
}
于 2012-04-15T23:28:04.300 回答