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

ヘッダーには2つのネストされた固定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のborder-radiusを使用しました。これを8pxに調整するときは、パディングと高さを調整することを忘れないでください。

于 2013-02-18T12:50:16.647 に答える