2014-01-23 3 views
0

헤더에 문제가 있습니다. 두 개의 이미지가 있습니다. 하나는 x 축에서 반복되는 배경 타일입니다. 중앙에있는 로고 이미지와 왼쪽과 오른쪽에있는 탐색 버튼 2 개. 로고를 중앙에 배치하면 로고가 오른쪽으로 이동하는 링크가 기능을 상실합니다. 호버링이나 링크가 없습니다. 왜 이런 일이 일어 났을까요? 어떻게 수정해야합니까?헤더 이미지 오버라이드 기능

나는 이것에 익숙하지 않으므로 전에 수천 번 답변 한 질문에 친절하게 물어보십시오. 나는 내 문제를 봤 거든 어떻게 해야할지 알 수 없다. 바라건대, 여기 누군가가 나를 도울 수 있기를 바랍니다.

다음은 문제 및 코드를 볼 수있는 링크입니다.

<!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 : 여기

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

는 HTML입니다

로고가 100%의 폭을 가진 :after 클래스를 통해 추가 된 것 같습니다
/*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 사업부 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 클래스이므로 요소의 나머지 부분보다 높은 z- 색인에 표시되므로 다른 링크를 숨길 수 있습니다.

당신이 당신의 문제를 해결해야한다 아래에 로고에 대한 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; 제거 시도는 그것의 폭을 수정이 주어진다.