2017-07-29 11 views
-1

スライドショーを作成するウェブページを作成しています。そして、私はそれがフェード(カラーイメージカラー)を持っているようにしたい。私は色のアルファ色を持つ背景にすることを決めたので、私は何をする必要があるだけで、後ろに画像を配置し、フェードは常にそこにとどまるだろう。背景をHTML/CSSで背景に置きます

enter image description here

今、私は背景の後ろに画像を配置する方法は?

body { 
 
\t text-align: center; 
 
\t background-image: url("http://i.imgur.com/jBqKhtV.png"); 
 
\t background-repeat: no-repeat; 
 
\t background-position: center 1.5%; 
 
\t background-color: #141414 
 
} 
 

 
.logo { 
 
\t position: absolute; 
 
\t z-index: 11; 
 
\t width: 247px; 
 
\t top: 17px; 
 
\t margin-left: -112px; 
 
} 
 

 
.headline { 
 
\t display: inline-block; 
 
\t margin-top: 220px; 
 
} 
 

 
h1 { 
 
\t font-size: 10pt; 
 
\t font-family: Lucida Sans; 
 
\t color: grey; 
 
\t font-style: italic; 
 
\t font-weight: normal; 
 
} 
 

 
.underline { 
 
\t width: 630px; 
 
\t height: 1px; 
 
\t background-color: white; 
 
\t left: 0px; 
 
\t right: 0px; 
 
\t margin: auto; 
 
\t top: 270px; 
 
\t position: absolute; 
 
\t z-index: 12 
 
} 
 

 
.navigation { 
 
\t width: 630px; 
 
\t height: 60px; 
 
\t position: aboslute; 
 
\t z-index: 13; 
 
\t left: 0px; 
 
\t right: 0px; 
 
\t margin: auto; 
 
} 
 

 
h2 { 
 
\t margin-top: 30px; 
 
\t color: white; 
 
\t font-family: Lucida Sans; 
 
\t font-size: 15pt; 
 
\t float: left; 
 
\t margin-left: 65px; 
 
\t font-weight: normal; 
 
} 
 

 
.home { 
 
\t margin-left: 68px; 
 
} 
 

 
.slideshow { 
 
\t width: 1330px; 
 
\t height: 630px; 
 
\t position: absolute; 
 
\t z-index: -5; 
 
\t left: 0px; 
 
\t right: 0px; 
 
\t margin: auto; 
 
}
<!DOCTYPE html> 
 
<html lang="en"> 
 
<head> 
 
\t <link rel="stylesheet" type="text/css" href="Home_Stylesheet.css"> 
 
</head> 
 
<body> 
 
\t <center> 
 
\t \t <img src="http://i.imgur.com/DlXvHKb.png" class="logo"> 
 
\t </center> 
 
\t 
 
\t <div class="headline"> 
 
\t \t <h1>Cyprus Griptape Manufacturers</h1> 
 
\t </div> 
 
\t 
 
\t <div class="underline"></div> 
 
\t 
 
\t <div class="navigation"> 
 
\t \t <h2 class="home">Home</h2> 
 
\t \t <h2>Store</h2> 
 
\t \t <h2>About Us</h2> 
 
\t \t <h2>Contact Us</h2> 
 
\t </div> 
 
\t 
 
\t <div class="slideshow"> 
 
\t \t 
 
\t </div> 
 
</body> 
 
</html>

+0

html cssコードが必要です – amit77309

+0

最初に[ask]をお読みください。質問自体に[mcve]を追加するよりも。画像を検査することはできません。既存のコードを確認する必要があります。 –

+0

画像は私が行っている効果ではありません。私が望むものがまったく可能であるかどうかだけはわかりませんでした –

答えて

0

何をしたいのためのシンプルな、最も一般的な解決策はあるに:

  • 場所コンテナ/ラッパー内のあなたのスライダー、それを与える:
.slider-wrapper { 
    position:relative; 
    z-index: 0; 
} 
  • 場所、同じコンテナであなたのスライダーの兄弟、それを与える:
.slider-wrapper .overlay { 
    position:absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    /* background effect of your choice here */ 
    z-index: 1; 
    pointer-events: none 
    /* this lets pointer events through, to enable interacting with the slider */ 
} 

マークアップのようなものでなければなりません。その結果

<div class="slider-wrapper"> 
    <div class="slider"> Your slider here </div> 
    <div class="overlay"></div> 
</div> 

を、あなたが配置しています(他の兄弟、スライダによって設定された)コンテンツと同じサイズを持ち、pointer-eventsをキャッチしない、目的の背景効果を持つ、スライダ上のオーバーレイ。それはあなたが望んだものですよね?