2016-08-28 4 views
1

z-indexプロパティを使用して記事の前にテキストを配置しようとすると、z-indexは何にも影響していないようです。ここで私が使用しているコードです。z-indexは効果がありません

CSSコード

#hero-content { 
    position: fixed; 
    top: 50%; 
    left: 50%; 
    width: 100%; 
    transform: translateX(-50%) translateY(-50%); 
    z-index: 1; 
} 

#hero-computers { 
    position: fixed; 
    top: 50%; 
    left: 50%; 
    transform: translateX(-50%) translateY(-50%); 
    width: 600px; 
    height: auto; 
    opacity: 0.7; 
    z-index: 0; 
} 

<div id="hero-content"> 
    <div id="hero-title">Best Game Servers</div> 
    <img id="hero-computers" src="img/hero-computer.png"> 
</div> 
+0

を追加#hero-computers { z-index: -1; }

  • を試してみてくださいか試してみてください主人公のここに? – kukkuz

  • 答えて

    2
    1. HTMLコードをあなたの代わりに `英雄-title`を使用する必要があります#hero-title { z-index: 2; position: relative; }
    +0

    素晴らしい作品です!ありがとうm8 –

    関連する問題