2014-01-23 72 views
0

我遇到了一些與我的標題有關的問題。有兩個圖像。一個是在x軸上重複的背景圖塊。中心和導航的徽標圖像在其左側和右側按下兩個按鈕。當我將徽標放在中心位置時,徽標右側的導航鏈接失去了功能。沒有懸停或鏈接。爲什麼會發生?我如何解決它?標題圖像覆蓋導航功能

我對此很陌生,所以如果我問了一個已經回答了幾千次之前的問題,請溫柔一下。我GOOGLE了我的問題,並不知道該怎麼做。希望這裏有人能幫助我。

下面是查看問題和代碼的鏈接。

http://jsbin.com/iqoQuGAy/11/edit

下面是HTML:

<!DOCTYPE HTML> 
<html> 
<head> 
<meta charset="UTF-8"> 
<title>why?</title> 
<meta name="viewport" content="width=device-width, initial-scale=1.0"> 
<!--[if lt IE 9]> 
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> 
<![endif]--> 
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" /> 
</head> 
<body> 
<!--HEADER --> 
<header> 
<div id="pageHeader"> 
<a href="#" id="logo"></a> 
<!--NAVIGATION --> 
<nav id="mainNav"> 
<ul> 
<li id="about-link"><a href="#about">about</a></li> 
<li id="work-link"><a href="#work">work</a></li> 
<li id="contact-link"><a href="#contact">contact</a></li> 
<li id="resume-link"><a href="#resume">resume</a></li> 
</ul> 
</nav> 
</div> 
</header> <!-- end header --> 
</body> 
</html> 

而CSS:

/*Global styles*/ 

/*limited reset*/ 
html, body, div, section, article, aside, header, hgroup, footer, nav, h1, h2, h3, h4, h5, h6, p, blockquote, address, time, span, em, strong, img, ol, ul, li, figure, canvas, video, th, td, tr { 
margin: 0; 
padding: 0; 
border: 0; 
vertical-align:baseline; 
font: inherit; 
} 

/*html5 display rule*/ 
address, article, aside, canvas, details, figcaption, figure, footer, header, hgroup, nav, menu, nav, section, summary { 
display: block;} 


html { 
background-color: #E7E9D1; 
background-image: url(http://s24.postimg.org/4rcaja0lh/image.png); 
} 

body 
{ 
position: relative; 
font-family: Arial, helvetica, sans-serif; 
font-size: 14px; 
} 

/*header styles*/ 
header 
{ 
background-image: url("http://s7.postimg.org/59ft4upyf/header_bg.png"); 
background-repeat: repeat-x; 
left: 0; 
position: fixed; 
top: 0; 
width: 100%; 
z-index: 200; 
} 
#pageHeader 
{ 
height: 128px; 
margin: 0 auto; 
position: relative; 
width: 960px; 
} 
#pageHeader:after 
{ 
content: ''; 
display: block; 
position: absolute; 
width: 100%; 
height: 100%; 
left: 425px; 
top: 0; 
background: url('http://s18.postimg.org/5ktpz4rid/logo.png') 0 0 no-repeat scroll; 
} 

/*nav styles*/ 
#mainNav { 
font-size: 18px; 
list-style: none outside none; 
text-align: center; 
padding-top: 20px; 
} 

#mainNav li { 
display: inline; 
} 

#mainNav a { 
text-decoration: none; 
color: rgb(252,250,230); 
display: inline-block; 
padding: 10px; 
} 

#mainNav a:hover { 
color: #9f9e8f; 
} 

#mainNav #about-link { 
margin-right: 50px; 
} 
#mainNav #work-link { 
margin-right: 0px; 
} 
#mainNav #contact-link { 
margin-left: 160px; 
} 
#mainNav #resume-link { 
margin-left: 20px; 
} 

回答

0

你#pageHeader DIV WAZ設置爲width: 100%;這是覆蓋你的鏈接。給它一個寬度修復了這個:

#pageHeader:after { 
    content: ''; 
    display: block; 
    position: absolute; 
    width: 120px; 
    height: 100%; 
    left: 425px; 
    top: 0; 
    background: url('http://s18.postimg.org/5ktpz4rid/logo.png') 0 0 no-repeat scroll; 
} 

這裏是固定鏈接:JS Bin

+0

Enijar和badAdviceGuy - 你們真棒,完全解決了我的問題!謝謝! – oldbroad

+0

@oldbroad不客氣。請記住接受我們的答案之一。 – Enijar

+1

只需點擊檢查。正確? – oldbroad

0

它看起來像標誌是通過:after類添加的100%的寬度。由於它是一個:after類,它將顯示在比元素的其餘部分更高的Z-index上(因此掩蓋了其他鏈接)。

如果更改徽標以低於它應該解決您的問題,你的CSS條目:

#pageHeader:after { 
content: ''; 
display: block; 
position: absolute; 
width: 120px; 
height: 120px; 
left: 425px; 
top: 0; 
background: url('http://s18.postimg.org/5ktpz4rid/logo.png') 0 0 no-repeat scroll; 
} 
-1

嘗試從body規則刪除position: relative;