2016-11-17 47 views
-1

在我腦子裏,我想用「你的形象比我們更重要。」有更重要的重點。標題生成

我也想,要帶下劃線和陰影,以配合紅色背景(白色陰影)。這也加重我辯論是否應該閃爍或淡出。

出於某種原因,我的CSS不工作就可以了。 HTML代碼:

<!-- This is a HTML Document--> 

    <head> 
     <meta charset="utf-8"> 
     <meta name="viewport" content="width=device-width, initial-scale=1"> 
     <link rel="stylesheet" href="dld.css"> 
     <title>Dave's Logo Designs</title> 
    </head> 
    <header> 
     <div id="header"> 
      <h1>Your Image is <em>More Important</em> Than Ours</h1> 
     </div> 
    </header> 
    <body> 
     <h1>Welcome to the official site of Dave's Logo Designs<h1> 
    </body> 
    </html> 

CSS到目前爲止:

header { 
     width: 100%; 
     height: 200px; 
    } 
    header:h1 { 
     color: red; 
     text-shadow: 0px 2px 2px white; 
     font-size: 25px; 
     font-family: impact; 
    } 
    header:em { 
     color: white; 
     font-weight: bold; 
     text-decoration: underline; 
     font-size: 30px; 
     font-family: impact; 
    } 

沒有的工作。可能在我的結局上有些愚蠢。我在這裏先向您的幫助表示感謝。

+2

你應該把''

你''標籤內。 –

+0

選擇器也應該是'的#header> h1'和'的#header em'。 – Gavin

+0

非常感謝。我在飛行中學習。希望我能理清這一點。 –

回答

0

你應該把YOUT body標籤內header標籤。

<html> 
    <head> 
     <meta charset="utf-8"> 
     <meta name="viewport" content="width=device-width, initial-scale=1"> 
     <link rel="stylesheet" href="dld.css"> 
     <title>Dave's Logo Designs</title> 
    </head> 
    <body> 
     <header> 
      <div id="header"> 
       <h1>Your Image is <em>More Important</em> Than Ours</h1> 
      </div> 
     </header> 
     <h1>Welcome to the official site of Dave's Logo Designs<h1> 
    </body> 
</html> 

,改變你的CSS選擇器

header { 
    width: 100%; 
    height: 200px; 
} 

header h1 { 
    color: red; 
    text-shadow: 0px 2px 2px white; 
    font-size: 25px; 
    font-family: impact; 
} 

header em { 
    color: white; 
    font-weight: bold; 
    text-decoration: underline; 
    font-size: 30px; 
    font-family: impact; 
} 

headerh1之間的空間。

它會導致像這樣(深綠色背景添加顯示斜體文本是白色的)。

enter image description here

+0

我有一個黑色的背景,紅色文本H1去,黃色爲重點,拿出下劃線和陰影。我還在圖像下方插入了我的徽標。我認爲它看起來不錯。我似乎無法讓它正確地居中。 –

+0

@ Dave的Logo設計爲了居中,只需添加'display:block; text-align:center;'進入'header h1' –

+0

當涉及到我網站上的所有項目時,我應該使用div來處理所有項目嗎? –