이것이 작동하지 않는 이유에 대해 완전히 이해하기 어렵습니다. 둘 다 같은 디렉토리에 있더라도 HTML 파일이 CSS를로드 할 수없는 것 같습니다. 어떤 아이디어가 문제 일 수 있습니까?HTML이 CSS 파일을로드하지 않습니다.
index.html을 위의 내용 작동하지 않습니다
body{
background-color: #F9F9F9;
background-image: url(images/bg3.png);
background-position: center top;
background-repeat: repeat;
text-shadow: #FFFFFF 0px 1px 0px;
font-family: "Georgia", "Times", serif;
-webkit-font-smoothing: antialiased;
}
a{
text-decoration: none;
}
#main{
margin: 50px auto 50px auto;
width: 1000px;
min-height: 500px;
padding: 0px 20px 0px 20px;
}
<!DOCTYPE html>
<html>
<head>
<title>Home Page</title>
<link rel="stylesheet" href="style.css" media="screen" />
<meta name="viewport" content="width=1100">
</head>
<body>
<div id="main"> Hello </div>
</body>
</html>
있는 style.css. index.html을에서 CSS를 인라인을 추가하면이 더 이상 최신 브라우저에 필요하지 않을 수도 있지만 그래도
<!DOCTYPE html>
<html>
<head>
<title>Homepage</title>
<style type="text/css" media="screen">
body {
background-color: #F9F9F9;
background-image: url(images/bg3.png);
background-position: center top;
background-repeat: repeat;
text-shadow: #FFFFFF 0px 1px 0px;
font-family: "Georgia", "Times", serif;
-webkit-font-smoothing: antialiased;
}
a {
text-decoration: none;
}
#main {
margin: 50px auto 50px auto;
width: 1000px;
min-height: 500px;
padding: 0px 20px 0px 20px;
}
</style>
<meta name="viewport" content="width=1100">
</head>
<body>
<div id="main"> Hello </div>
</body>
</html>
두 파일이 같은 디렉토리에 있습니까? 파일 이름을 변경하여 두 파일에 모두 액세스 할 수 있습니까 (예 : http://example.com/index.html -> http://example.com/style.css)? 대신 절대 경로 ('/ style.css')를 사용해 보셨습니까? – Zeta
어떤 브라우저를 사용하고 있습니까? style.css의 파일 권한을 이미 확인 했습니까? 구문 분석 문제를 확인하기 위해 CSS의 유효성을 검사하려고 시도 했습니까? – fcalderan
유형 = "text/css"를 추가해도 F12 개발자 도구가 실패하면 네트워크 모니터를보고 .css url이 요청 했습니까? 괜찮습니까? –