2016-11-24 148 views
-1

這是我的第一篇文章,所以請原諒我的格式,如果它不正確。我正在構建一個項目,並且遇到了我的div問題。在我的項目中,我無法讓我的div顯示出他們的CSS風格。空格在那裏,他們應該是,但div(卡)應該是黃色的黑色邊框。爲什麼我的div標籤不顯示?

<!DOCTYPE html> 
<html> 

<head> 
    <title>Memory Card Game</title> 
    <link rel="stylesheet" type="text/css" href="style.css"> 
</head> 

<body> 
    <h1>Memory Game</h1> 
    <nav a="#"><h2>Instructions</h2></nav> 
    <nav a="Game">Game</nav> 
    <p>Concentration, also known as Match Match, Memory, Pelmanism, Shinkei-suijaku, Pexeso, or Pairs, is a card game in which all of the cards are laid facedown on a surface and two cards are flipped face up over each turn. The object of the game is to turn over pairs of matching cards.</p> 
    <div class="board"> 
     <div class="card"></div> 
     <div class="card"></div> 
     <div class="card"></div> 
     <div class="card"></div> 
    </div> 

    <footer>Created with ♥ by <span class="name">GA</span></footer> 

    <script type="text/javascript" src="main.js"></script> 
</body> 

</html> 



h1 { 
    color: rgb(2, 132, 130); 
} 
h2 { 
    color: #ffd700; 
} 

body { 
    text-align: center; 
} 

.board { 
    display: inline-block; 
    height: 80%; 
    width: 50%; 
    background-color: yellow; 
} 
.card { 
    height: 200px; 
    width: 150px; 
    border-color: black; 
    border-width: 10px; 
    border-radius: 10px; 
} 
.name { 
    color: #ff0000; 
} 

的我的變化做了更新:​​ http://imgur.com/a/GEXot

下面是什麼我的網頁在做什麼,它應該是什麼樣子的屏幕截圖。

https://imgur.com/a/1lyl4#bel6qqd

+6

怎麼可能告訴從圖像?在你的問題中發佈[mcve]。 – j08691

+0

將'color:black'更改爲'background-color:black'。但是你不想使用黃色?圖像中的卡片是黃色的。 –

+0

感謝您的幫助,我的更新背景爲黃色,但卡片仍未顯示。 – Christopher

回答

-2
<link rel="stylesheet" type="text/css" href=" style.css"> 

替換此

+0

如何爲文件名添加空格可解決以上任何問題? – Xufox

0

你的鏈接,您可以更改CSS如下

h1 { 
color: rgb(2, 132, 130); 
    } 
h2 { 
color: #ffd700; 
} 

body { 
text-align: left; 
} 

.board { 
display: inline-block; 
height: 80%; 
width: 50%; 
color: yellow; 
} 
.card { 
height: 200px; 
width: 150px; 
border:solid 1px black; 
border-radius: 10px; 
color: black; 
background-color:yellow; 
} 
.name { 
color: #ff0000; 
} 

請查看我的截圖中我們http://prntscr.com/db2se1

相關問題