2012-03-22 1 views
1

내 코드는 w3school에 의해 검증되었지만 여전히 IE와 Firefox에서 다르게 표시됩니다.내 CSS + HTML 웹 페이지가 IE 및 FireFox에서 다르게 표시되는 이유는 무엇입니까?

내 링크 모음은 IE에서 캐스케이드로 표시되지만 파이어 폭스에서는 뻔뻔한 선으로 표시됩니다 !!!

내 HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
"http://www.w3.org/TR/html4/strict.dtd"> 

<html> 

<head> 

<link rel="stylesheet" type="text/css" href="lbf.css"> 

<title>Love British Film</title> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 

</head> 
<body> 
<div id="main_container">fegerfg 

    <div id="header"> 
    <div class="logo">Love British Film.com </div> 
    </div> 
    <div class="nav_bar"> 
     <ul class="nav_list"> 

     <li class="odd"><a href="index.html">Home</a></li> 
     <li class="even"><a href="index.html">Reviews</a></li> 
     <li class="odd"><a href="index.html">Forums</a></li> 
     <li class="even"><a href="index.html">Videos</a></li> 
     <li class="odd"><a href="index.html" >Downloads</a></li> 
     <li class="even"><a href="index.html">News</a></li> 
     <li class="odd"><a href="index.html" >Fun bits</a></li> 
     <li class="even"><a href="index.html">Contact us</a></li> 
     </ul> 
    </div> 




     <div class="main_text"> 
     <div class="header">HEADER FOR MAIN CONTENT</div> 


     Main content!! 
     </div> 

     <div id="film_of_day">Film of day </div> 




     <div id="poll_of_week">asdnasdljasasdasfdasfasfas</div> 




</div> 
</body> 
</html> 

그리고 내 CSS 코드를 현실 세계에

body 
{ 
background:url(bg.jpg) no-repeat #FFF center top; 
padding:0; 
font-family:Arial, Helvetica, sans-serif; 
font-size:11px; 
margin:0px auto auto auto; 

} 

div { 
margin: 0px; 
padding: 0px; 
width: 0px; 
} 

#main_container{ 
width:1200px; 
height:auto; 
margin:auto; 
padding:0px; 
} 
#header{ 
position:relative; 
width:1200px; 
height:170px; 
background:url(header.jpg) no-repeat center; 
background-position:0px 0px; 
margin:auto; 
padding:5px; 
} 
.logo{ 
width:auto; 
height:auto; 
font-size:20px; 
position:relative; 
top:80%; 
text-align:right; 
} 
.nav_bar{ 
width:1200px; 
height:50px; 


} 
ul.nav_list{ 
list-style-type:none; float:left; display:block; width:1200px; 
margin:0px; padding:0px; 
} 

ul.nav_list li.odd a{ 
display:block;width:150px; text-align:center; float:left;text-decoration:none; background:url(images/home.png) no-repeat left; 
background-color:rgb(147,216,255);height:40px; line-height:40px; color:rgb(168,100,63); 
} 
ul.nav_list li.even a{ 
display:block;width:150px; text-align:center; float:left;text-decoration:none; background:url(images/home.png) no-repeat left; color:rgb(168,100,63); 
height:40px; line-height:40px;background-color:rgb(26,142,165); 
} 
a.odd:link, a.odd:visited { 
display:block;width:133px; text-align:center; float:left;text-decoration:none; background:url(images/home.png) no-repeat left; } 
ul.nav_list li.even a:hover{background-color:#A29;} 
ul.nav_list li.odd a:hover{background-color:#F99;} 

a.even:link, a.even:visited { 
display:block;width:133px; text-align:center; float:left;height:40px;text-decoration:none; background:url(images/home.png) no-repeat left; color:#676d77;} 
a.even:hover{ 
color:#FFFFFF; 
} 



.header{ 
width:500px; 
text-align:center; 
margin-bottom:50px; 
} 
.main_text{ 
display:inline-block; 
float:left; 
width:600px; 
height:600px; 
background-color:rgb(147,216,255); 
} 

#film_of_day{ 
float:right; 
width:340px; 
height:250px; 
background-color:rgb(147,216,255); 

} 


#poll_of_week{ 
margin-top:50px; 
float:right; 
width:280px; 
height:250px; 
outline:solid; 
padding:1px; 
} 
+7

... – dougajmcdonald

+1

@ dougajmcdonald 하나님, 내가 그것을 upvote 수 있도록 대답으로 게시하시기 바랍니다 : - EPIC! –

+0

왜 내가 걱정해야합니까? 내 HTML 및 CSS 파일을 W3 유효성 검사기 웹 사이트에 업로드했으며 모두 녹색이고 양호했습니다. ???? –

답변

3

li 태그 안에 a 태그가 떠 다니므로 문제가 발생하기 쉽지 않습니다.

당신은 당신의 li 태그를 부유하고 떠나야한다 당신의 해제 굴러 링크로 내부 a 태그

참조 : http://jsfiddle.net/ZmhzA/1/ 당신 코드 'w3school'에 의해 검증 된 경우 내가 걱정 거라고 그냥 참조 용

+0

감사합니다! 그게 내 크로스 브라우저 문제를 정렬! 이제 다른 브라우저에서 내 코드를 확인해야합니다 ... 다시 한 번 감사드립니다 :) –

7

에 오신 것을 환영합니다.
IE와 Firefoy는 서로 다른 CSS를 해석합니다. 이것은 항상 문제 였고, 그것은 항상있을 것입니다! 다른 동작이나 모양을 줄이려면 소위 CSS 재설정을 사용해보십시오.

CSS 재설정이란 무엇입니까?
이것은 브라우저에서 기본적으로 오는 모든 위치, 채우기, 여백을 모두 0으로 재설정하는 간단한 CSS 파일입니다. 따라서 대부분의 스타일을 동일하게 해석 할 수 있습니다. 물론 여전히 동일하지는 않지만 올바른 방향으로 배치하는 데 도움이됩니다. 또한 GridLayouts를 위치 지정에 사용할 수도 있습니다.이 도구는 또한 대다수의 브라우저에서 작동하고 동일하게 작동합니다.

그리고 다만 힌트

관련 문제