文字没有在html中显示在背景上

时间:2015-02-16 15:17:25

标签: html css web

如果可能,我有一个白痴的问题,我找不到这个问题的答案;

我正在尝试编写一个新网站,我已经完成了背景,没有什么可担心的!

现在,文字正在将背景移到一边!让我告诉你problem

它应该是什么,是在背景上而不移动它!

代码:

HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Evasion Online</title>
    <link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div id="wrapper">
         <div id="header">
         </div>
         <div id="navigator"><!--START NAV-->
            <div class="nav"><!--START NAV CLASS-->
            <nav>
                <ul>
                    <li><a href="#">Home</a></li><br>
                    <li><a href="#">Register</a></li><br>
                    <li><a href="#">Download</a></li><br>
                    <li><a href="#">About</a></li><br>
                    <li><a href="#">Shit</a></li><br>
                </ul>
            </nav>
            </div><!--END NAV CLASS-->
         </div><!--END NAV-->
            <div id="nav">

           </div>
           <div id="leftside"><!--START LEFTSIDE-->
                <div class="statistics">

                </div>
                <div class="rank">

                </div>
            </div><!--END LEFTSIDE-->
            <div id="main"><!--START MAIN-->
                <div class="news">

                </div>
            </div><!--END MAIN-->
            <div id="rightside"><!--START RIGHTSIDE-->
                <div class="login">

                </div>
                <div class="exclusive">

                </div>
            </div><!--END RIGHTSIDE-->

            <div id="block_content">

            </div>

            <div id="footer">

            </div>
    </div>
</body>
</html>

CSS

    html, body, div, span, applet, object, iframe,h1, h2, h3, h4, h5, h6, p, blockquote, pre,a, abbr, acronym, address, big, cite, code,del, dfn, em, img, ins, kbd, q, s, samp,small, strike, strong, sub, sup, tt, var, u, i, center,dl, dt, dd, ol, ul, li,fieldset, form, label, legend,caption, tbody, tfoot, thead, th, td,article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary,time, mark, audio, video {   margin: 0;  padding: 0; border: 0;  font-size: 100%;    font: inherit;  vertical-align: baseline;}/* HTML5 display-role reset for older browsers */article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {    display: block;}body {  line-height: 1;}ol, ul {    list-style: none;}blockquote, q {   quotes: none;}blockquote:before, blockquote:after,q:before, q:after {   content: '';    content: none;}
table{
margin: 0;  padding: 0;     font-size: 100%;    font: inherit;  vertical-align: baseline;
}
/*#############*/
/*STARTING CSS*/

body{
    background:url('imgs/bg.png') top center no-repeat;
    height:100%;
    margin: 0;
    padding:0;
    font-family:Tahoma;
    background-repeat:no-repeat;
    font-size:12px;
    overflow-x:auto;
    left:0;
    right:0;
}

#wrapper {
    width:1280px;
    margin: 0 auto;
}

#header{
    float: left;
    background:url('imgs/header.jpg') no-repeat;
    width:1280px; height:837px;
    background-size: 100% 100%;
}
a {
    display: block;
}
.nav{
    float: left;
    position: relative;
    list-style-type: none;
}
.nav ul{
    padding:0;
    margin:0;
}
.nav li{
    float: left;
    margin: 0 0.15em;
}

#leftside{
    float:left;
    background:url('imgs/leftside.jpg') no-repeat;
    width:346px; height:788px;
    background-size: 100% 100%;
}
#main{
    float:left;
    background:url('imgs/main.jpg') no-repeat;
    width:585px; height:788px;
    background-size: 100% 100%;
}
#rightside{
    float:left;
    background:url('imgs/rightside.jpg') no-repeat;
    width:349px; height:788px;
    background-size: 100% 100%;
}
#footer {
    float:left;
    background:url('imgs/footer.jpg') no-repeat;
    width:1280px; height:333px;
    background-size: 100% 100%;
}
.container {
    width:1280px;
    margin:0 auto;
}

2 个答案:

答案 0 :(得分:0)

我不清楚你的照片和代码如何显示背景。但是,如果您只想要一个固定的背景来覆盖整个页面上的任何内容,只需定义正文的背景图像。

如果像main这样的div有自己的背景,那么这些div将随div一起移动,具体取决于它们中的内容,并且调整浏览器的大小会使它们在整个地方蠕动。

您可能还想为nav元素设置背景样式,以摆脱白色背景。尝试

nav { background-color:transparent; }

答案 1 :(得分:0)

固定!

我只是把它放在标题标签里。抱歉浪费你的时间!

感谢帮助无处不在。