2017-08-03 8 views
0

私は、表紙画像の上にグラデーションレイヤーを作成しようとしています。私はなぜこのように起こっているのか分かりません。CSS - Cover Image Gradient Over

以下のコードをご覧ください。

出典:例えばWallpaper

header { 
 
    position: relative; 
 
    height: 300px; 
 
    background-repeat: no-repeat; 
 
    background-position: center bottom; 
 
    background-image: url('http://wallpaperlatest.com/wp-content/uploads/latest-wallpapers-in-full-hd-definition.jpg'); 
 
    background-size: cover; 
 
    border-bottom-left-radius: 50%; 
 
    border-bottom-right-radius: 50%; 
 
} 
 

 
h1 { 
 
    margin: 0; 
 
    padding: 100px 0; 
 
    font: 44px "Arial"; 
 
    text-align: center; 
 
} 
 

 
header h1 { 
 
    color: white; 
 
}
<header> 
 
    <h1>Header Content | Source: http://wallpaperlatest.com</h1> 
 
</header> 
 

 
<section> 
 
    <h1>Section Content | Source: http://wallpaperlatest.com/</h1> 
 
</section>

+1

コードのどこにでもグラデーションが表示されません。あなたは「私はなぜこのように起こっているのか理解していません」と言ったとき、あなたは何を指していますか? –

+0

あなたはあなたが何を期待しているのか、そして何がうまくいかないのかを精緻化する必要があります。グラデーションはあなたが探している正しい言葉ですか? – Don

+0

ああ、ちょっとしたことでコードを編集できます。私はCtrlキーを押しながらKを入力する多くの間違いを示したコードを挿入すると問題が発生しました。私はちょうどいくつかの行を編集した、私はそこにバックスペースを持っている必要があります。ごめんなさい。 –

答えて

0

これを試してみてください:

header { 
 
    position: relative; 
 
    height: 300px; 
 
    background-repeat: no-repeat; 
 
    background-position: center bottom; 
 
    background-image: linear-gradient(to bottom right, rgba(0, 47, 75, .8), rgba(220, 66, 37, .8)), url('http://wallpaperlatest.com/wp-content/uploads/latest-wallpapers-in-full-hd-definition.jpg'); 
 
    background-size: cover; 
 
    border-bottom-left-radius: 50%; 
 
    border-bottom-right-radius: 50%; 
 
} 
 

 
h1 { 
 
    margin: 0; 
 
    padding: 100px 0; 
 
    font: 44px "Arial"; 
 
    text-align: center; 
 
} 
 

 
header h1 { 
 
    color: white; 
 
}
<header> 
 
    <h1>Header Content | Source: http://wallpaperlatest.com</h1> 
 
</header> 
 

 
<section> 
 
    <h1>Section Content | Source: http://wallpaperlatest.com/</h1> 
 
</section>

+0

素晴らしいです。理解してお答えいただきありがとうございます。 –

+0

この回答を参考にしてください。 –

+0

私はちょうど@ Chandra Kumarを私の口座が新しくなったので公にするつもりはないと言っています... !!しかし、私はあなたに従います。 –