1

私はこれを達成しようとしています: https://www.dropbox.com/s/3zm1qssd3299uat/Social-Bottom.jpg

上の画像のように、背景 div の上にコンテンツ div が必要です。

これが私の現在のコードです:

<!DOCTYPE html>
<html>
<head>
    <title>VisionBeat DJ's Australia</title>
    <script type="text/javascript" src="./js/jquery.js"></script>
    <script type="text/javascript" src="./js/nav.js"></script>
    <LINK REL="SHORTCUT ICON" HREF="./favicon.ico">
    <style>
        @font-face {
            font-family:"bold";
            src: url('./fonts/bold.ttf');
        }
        @font-face {
            font-family:"sbold";
            src: url('./fonts/sbold.ttf');
        }
        @font-face {
            font-family:"regular";
            src: url('./fonts/regular.ttf');
        }
        @font-face {
            font-family:"light";
            src: url('./fonts/light.ttf');
        }
        @font-face {
            font-family:"elight";
            src: url('./fonts/elight.ttf');
        }
        html, body {
            height: 100%;
            width: 100%;
            overflow:auto;
            margin:0;
            padding:0;
            border:0;
            font-family:'regular', sans-serif;
        }
        #bg1 {
            height: 100%;
            width: 100%;
            background: url(./images/backgrounds/1.jpg) no-repeat center center fixed;
            -webkit-background-size: cover;
            -moz-background-size: cover;
            -o-background-size: cover;
            background-size: cover;
            z-index:0;
        }
        #bg2 {
            height: 100%;
            width: 100%;
            background: url(./images/backgrounds/2.jpg) no-repeat center center fixed;
            -webkit-background-size: cover;
            -moz-background-size: cover;
            -o-background-size: cover;
            background-size: cover;
            z-index:1;
        }
        #bg3 {
            height: 100%;
            width: 100%;
            background: url(./images/backgrounds/3.jpg) no-repeat center center fixed;
            -webkit-background-size: cover;
            -moz-background-size: cover;
            -o-background-size: cover;
            background-size: cover;
            z-index:2;
        }
        h1 {
            font-family:'bold', sans-serif;
            font-weight:700;
            color:#ecf0f1
        }
        h2 {
            font-family:'sbold', sans-serif;
            font-weight:600;
            color:#ecf0f1
        }
        p1 {
            font-family:'regular', sans-serif;
            font-weight:400;
            color:#ecf0f1
        }
        p2 {
            font-family:'light', sans-serif;
            font-weight:300;
            color:#ecf0f1
        }
        a {
            font-family:'elight', sans-serif;
            font-weight:300;
            color:#ecf0f1;
            top:0;
            bottom:0;
            left:0;
            right:0;
            text-decoration:none
        }
        a:hover {
            font-family:'elight', sans-serif;
            font-weight:200;
            color:#ecf0f1;
            top:0;
            bottom:0;
            left:0;
            right:0;
        }
        nav {
            color:rgba(45, 45, 45, 0.5);
            font-size:1.2em;
            font-weight:300;
            -webkit-touch-callout: none;
            -webkit-user-select: none;
            -khtml-user-select: none;
            -moz-user-select: -moz-none;
            -ms-user-select: none;
            user-select: none;
            transition: border-color 0.5s ease;
            border-top:1.5px solid;
            border-color:rgba(45, 45, 45, 0);
        }
        nav a {
            transition: border-color 0.5s ease;
            border-top:1.5px solid;
            border-color:rgba(45, 45, 45, 0);
        }
        nav a:hover {
            border-color: rgba(236, 240, 241, 0.9)
        }
        #floater {
            position:relative;
            float:left;
            height:50%;
            margin-bottom:-100px;
            width:1px;
        }
        #centered {
            position:relative;
            clear:left;
            height:250px;
        }
        #centerfit {
            text-align: center;
            margin-left: auto;
            margin-right: auto;
            max-height: 250px;
        }
        #sticky_navigation_wrapper {
            width:100%;
            height:30px;
        }
        #sticky_navigation {
            width:100%;
            height:32px;
            background-color:rgba(45, 45, 45, 0.75);
            text-align:center;
            -moz-box-shadow: 0 0 5px #999;
            -webkit-box-shadow: 0 0 5px #999;
            box-shadow: 0 0 5px #999;
        }
    </style>
</head>

<body>
    <div id="bg1">
        <div id="floater"></div>
        <div id="centered">
            <div id="centerfit">
                <img src="images/logo.png" alt="VisionBeat Logo">
            </div>
            <div id="sticky_navigation_wrapper">
                <div id="sticky_navigation">
                    <nav>
                        <a href="#Social">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Social&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
                        <a href="#Contact">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Contact&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
                        <a href="/">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Home&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
                        <a href="#Events">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Events&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
                        <a href="#Pricing">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Pricing&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
                    </nav>
                </div>
            </div>
        </div>
    </div>
    <section id="Social"></section>
    <div id="bg2"></div>
</body>

4

1 に答える 1

0

あなたがしたいのは、 body タグに背景画像を設定し、設定した要素に CSS ポジショニングを必ず使用することz-indexです。コンテンツ div が背景画像の上にないという問題に直面していると思います。content div の位置を絶対に設定し、必ず body タグに背景画像を設定してください。

于 2013-11-15T17:23:26.517 に答える