div
複数の背景色や画像をCSSに与えるにはどうすればよいですか?たとえば、上部を赤、中間を青、下を緑にします。複数の背景色、画像をCSSで
答えて
単一linear-gradient
背景が
background: linear-gradient(to bottom,
red 0, red 33.33%,
blue 0, blue 66.66%,
green 0, green 100%
);
Example十分であるとして| Browser support
ニース。 %記号のない0が何をしているのか説明できますか? –
カラーストップの仕組み:前回のカラーストップよりも値が小さいカラーストップを設定すると、前に定義した最大値に自動的に設定されます。つまり、赤色0、赤色33.33%、青色33.33、青色66.66%、緑色66.66、緑色100%と書かれていますが、反復値が少ない(たとえば、66.66を80%に変更した場合は、 – fcalderan
css3のグラデーションが使用されます。
YourDIVID {
background: red; /* For browsers that do not support gradients */
background: -webkit-linear-gradient(red, yellow, green); /* For Safari 5.1 to 6.0 */
background: -o-linear-gradient(red, yellow, green); /* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(red, yellow, green); /* For Firefox 3.6 to 15 */
background: linear-gradient(red, yellow, green); /* Standard syntax */
}
TOP、BOTTOM、ビルドアップ配線板等行
#multiple {
width: 700px;
height: 500px;
background:linear-gradient(red, yellow, green, blue, purple, orange);
}
センター複数色チュートリアル
:before
and :after
pseudo element rulesを使用すると、1つの要素に3つの異なる背景レイヤー(色と画像)を持たせることができます。
注:このソリューションでは、含まれている要素を背景の上に収める必要があります。そうでなければ、リンクはクリック可能ではなく、テキストは選択できません。
実際の例のコードスニペットを実行します。
.layered-backgrounds {
background-color: #C63;
background-image: url(https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png);
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
position: relative;
height: 400px;
z-index: 1;
}
.layered-backgrounds:before {
position: absolute;
content: " ";
top: 0;
height: 120px;
width: 100%;
background: #39C;
z-index: 2;
opacity: 0.8;
}
.layered-backgrounds:after {
position: absolute;
content: " ";
bottom: 0;
height: 120px;
width: 100%;
background: #9C3;
z-index: 3;
opacity: 0.8;
}
.layered-backgrounds .content {
position: relative;
z-index: 4;
}
<div class="layered-backgrounds">
<div class="content">
<a href="#">Clickable</a> and selectable contents.
</div>
</div>
- 1. CSS:背景色の背景画像
- 2. 複数の背景画像をCSSで
- 3. html css - 画像選択の背景色
- 4. CSS背景画像の色オーバーレイ
- 5. css背景画像が背景の背景色をぼやけている
- 6. CSS - 背景画像
- 7. CSS背景画像
- 8. CSSの画像背景
- 9. CSS内の背景画像
- 10. フッタの背景画像CSS
- 11. CSSの背景画像
- 12. スクロールCSSの背景画像
- 13. ストレッチCSSの背景画像
- 14. GWT CSSの背景画像
- 15. CSSの背景画像&ドロップシャドー
- 16. リセットCSSの背景画像
- 17. オーバーライドCSSの背景画像
- 18. 使用CSSの背景色の上に背景画像を作成する
- 19. 高さを制限する複数の背景画像CSS
- 20. CSS背景RGBA&BG画像
- 21. WebpackインラインCSS背景画像
- 22. CSSフェードイン背景画像
- 23. Jquery CSS背景画像rotate
- 24. フェードイン/アウト背景画像CSS
- 25. 背景画像上にCSSオーバーレイ画像
- 26. CSSで背景画像を色づける方法
- 27. CSS限定バックグラウンドリピート(複数の背景画像)
- 28. 画像の色や背景色を更新する画像
- 29. Javascriptを、変更CSSの背景画像の色が
- 30. 複数の透明な背景画像
こんにちは、このスレッドを見てみましょう。 http://stackoverflow.com/a/6457484/4362192 – cdslijngard