2013-03-29 48 views
0

這是我第一次使用堆棧溢出,所以我將不勝感激,如果你能爲我回答這個問題。我的CSS有問題,因爲它沒有顯示我想要在我的網站上顯示的三幅圖像。其中兩個圖像用於網站的頂部邊界和底部邊界,標題圖像是將顯示在網站上的主要圖像。 下面是我的css的副本,所以如果你能回到我身邊,我會比謝天謝地感謝你。css問題爲什麼不顯示我的圖片?

body, h1, p, nav ul { 
    margin: 0; 
    padding: 0; 
    color: "#B0E0E6"; 
} 
table{id:"Table_01" width="1500" border="0" cellpadding="0" cellspacing="0" 




} 
img { 
    id:top ; 
    src:"205 images/top.jpg"; 
    width:1750px; 
    height:154px; 

    margin-top: 5px; 
} 

nav ul li { 
    display:inline; 

} 

nav ul li a { 
    text-decoration: none; 
    color: black; 
    height: 40px; 
    border-bottom: 0px solid black; 
    border-top: 0px solid black; 
    padding-left: 300px; 
    padding-top: 5px; 
} 

nav ul li a:hover { 
    background-color: white; 
    color: red; 
} 
h1 { 
    padding-top: 50px; 
    padding-left: 0px; 
    color: yellow; 
    font-size: 90px; 

    white-space: nowrap; 
    margin-left:0px; 
    margin-top:150px; 
    position: relative; 
} 
h2 { 
    padding-top: 50px; 
    padding-left: 30px; 
    color: black; 
    text-align: left; 
    margin-left: opx; 

} 

h3 { 
    padding-top: 50px; 
    padding-left: 30px; 
    color: white; 
    margin-right:155px; 
    margin-top:-100px; 
    position: relative; 
    float: right; 
    text-align: top; 
} 




    } 
header { 
    background-image: url('banner.jpg'); 
    background-repeat: no-repeat; 
    height:400px; 
    width:1750px; 

    margin-top:250px; 
    position:relative; 
    float: left; 


} 





} 


footer ul { 
    list-style: none; 
} 
footer ul li { 
    display:inline; 
} 
footer ul li a { 
     text-decoration: none; 
    color: black; 
    height: 50px; 
    border-bottom: 0px solid black; 

    padding-left: 300px; 
    padding-top: 5px; 
} 
footer ul li a:hover { 
    background-color: blue; 
    color: black; 
} 
footer { 
    background-color: white; 
    bottom:0px; 
    width: 1750px; 
    color: white; 
    clear: both; 
    margin-bottom: 10px; 

} 
img { 

    src:"205 images/bottom.jpg"; 
    width:1750px; 
    height:132px; 
    alt:""; 
    position: relative; 
    bottom: 600px; 
} 

nav { 
    background-color: blue; 
    width: 1750px; 
    float: left; 
    margin-top: 130px; 
} 
article { 
    background-color:#ADD8E6 ; 
    color: black; 
    text-align:left; 
    margin-left: 0px; 
    margin-bottom: 5px; 
    font-size: 20px; 
    } 
forms{ 

margin-left:300px; 
width: 10em; 
margin-bottom: 300px 


} 

#page { 
    background-color: #ADD8E6; 
    width: 800px; 
    margin: auto; 
} 
+2

在css文件中有很多語法錯誤。特別是在你的表格規則中。 – rekire

+0

@rekire:「語法錯誤」是輕描淡寫的。 :) – patricksweeney

+1

你的表規則似乎暗示你假設你可以在你的CSS中放置HTML屬性,但事實並非如此。他們所做的事情有一些重疊,但HTML和CSS是完全不同的語言。你似乎也認爲把id:top;將選擇ID爲「top」的圖像。但要做到這一點的方法是用#top替換選擇器(img)。 –

回答

1

您應該閱讀更多關於CSS基礎知識。開始的好點是Mozilla Developer Network。你的css文件中有幾個語法錯誤。這裏試試這個:

.YourImageClass { 
    background:url("images/top.jpg"); 
    width: 1750px; 
    height: 154px; 
    margin-top: 5px; 
} 

但是請注意,這僅適用於與YourImageClass類元素。例如:

<div class="YourImageClass">...</div>