사이트의 모든 페이지에있는 기능이 별도의 HTML 파일에 있도록 만들려고합니다. header.html 파일을 만들었습니다.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>header</title>
<link href="../css/default.css" rel="stylesheet" type="text/css" />
<link href="../css/inc/header.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="identityAndLinksHeader">
<table>
<tr>
<td><a>Home</a></td>
<td><a>About</a></td>
<td><a>Privacy</a></td>
</tr>
</table>
</div>
</body>
</html>
그리고 다음 CSS :
@charset "utf-8";
/* CSS Document */
#identityAndLinksHeader
{
height: 50px;
width: 100%;
margin: 0, 0, 0, 0;
padding: 0, 0, 0, 0;
background-color: rgba(127, 140, 141,1.0);
}
파일은 잘 작동하며 다음과 같습니다. http://puu.sh/68SbK.png
그런 다음이 index.html 코드가 있습니다.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<link href="css/default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<object name="header" type="text/html" data="inc/header.html"></object>
</body>
</html>
그러나 이것을 실행할 때 헤더는 다음과 같습니다. http://puu.sh/68S9M.png
왜 이런 일이 일어나는지 아는 사람이 있습니까? 감사합니다!
첫 번째는 html5에서 type = "text / css"를 정의 할 필요가없고 두 번째로 #identityAndLinksHeader의 너비가 100 %이고 아마도 index.html에서이 작은 영역이 100 %입니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다