0

我想设计一个网站,页面的角落是圆形的(窗口所有角落都有黑色圆圈)。

为此,我将主体颜色设置为黑色,并在内容 div 中添加了一个圆角,这是其背景的一部分。

<body style="backgound: black">
  <div class="content" style="background: blue; border-radius: 8px;">
   ....
  </div>
</body>

之后我尝试过:

不工作的解决方案1

position: absolute;
height: 100%;

当内容高度大于窗口时不起作用,因为滚动时内容背景会隐藏。

不工作的解决方案2

position: fixed;
height: 100%;

内容高度大于窗口时不工作;不显示滚动条。

不工作的解决方案3

什么都没有。

当内容高度小于窗口时不起作用;底部为黑色。

丑陋的工作解决方案1

添加4张带边框的图片,位置固定

有谁知道这个问题的干净解决方案?css3 被接受。

谢谢

4

3 回答 3

1

我认为这应该有所帮助:

.content
{
   position: absolute;
   height: 100%;
   width: 100%;
   top: 0;
   left: 0;
   right: 0;
   bottom: 0;
   background blue;
   border-radius: 8px;
}

编辑此解决方案将起作用:

.content
{
   float:left;
   min-height: 100%;
   height: auto;
   width: 100%;
   background: blue;
   border-radius: 8px;
}

工作jsfiddle

此处使用 css3 的另一个示例calc()

于 2013-02-18T09:26:05.123 回答
0

你可以试试height:100%

body, html{height:100%}
.content{height:100%}

演示

于 2013-02-18T09:27:48.533 回答
0

对页眉使用两个嵌套的固定 div,对页脚使用相同的 div。

这适用于每种浏览器上的每种内容:

运行示例:http: //jsfiddle.net/5kgN3/

HTML

<div id="headerOuter"><div id="headerInner"></div></div>
<div class="content">
    <br />test
    <br />test
    <!-- More tests here -->
    <br />test
    <br />test
</div>
<div id="footerOuter"><div id="footerInner"></div></div>

CSS

body, html {
    height: 100%;
    width: 100%;
}
.content {    
    min-height: 100%;
    height: auto;
    width: 100%;
    background: blue;
    padding-top: 20px;
    padding-bottom: 20px;
}

#headerOuter{
    background-color: black;
    height: 20px;
    width: 100%;
    position: fixed;
    top: 0;
}

#headerInner{
    border-radius: 20px 20px 0px 0px;
    background-color: blue;
    height: 20px;
    width: 100%;
    position: fixed;
    top: 0;    
}

#footerOuter{    
    background-color: black;
    height: 20px;
    width: 100%;
    position: fixed;
    bottom: 0;
}

#footerInner{
    border-radius: 0px 0px 20px 20px;
    background-color: blue;
    width: 100%;
    height: 20px;
    position: fixed;
    bottom: 0;
}

我使用了 20px 的边框半径,将其调整为 8px 时,请记住调整填充和高度。

于 2013-02-18T12:50:16.647 回答