我的嵌入方法是这样编码的:
<embed type="text/html" src="header.html">
现在,我成功地将header.html
文件嵌入到index.html
中,但结果我也从顶部标题得到了一个奇怪的长填充间隙。
header.html
文件:
<div class="top-main-area text-center">
<div class="container">
<a href="index.html" class="logo mt5">
<img src="img/logos/logo4.png" />
</a>
</div>
</div>
<header class="main">
<div class="container">
<div class="row">
<div class="col-md-6">
<!-- MAIN NAVIGATION -->
<div class="flexnav-menu-button" id="flexnav-menu-button">Menu</div>
<nav>
<ul class="nav nav-pills flexnav" id="flexnav" data-breakpoint="800">
<!-- a couple of li here -->
</ul>
</nav>
<!-- END MAIN NAVIGATION -->
</div>
<div class="col-md-6">
</div>
</div>
</div>
</header>
<div class="gap"></div>
这是我如何嵌入它在index.html
:
<head>
<!-- Bootstrap styles -->
<link rel="stylesheet" href="css/boostrap.css">
<link rel="stylesheet" href="css/font_awesome.css">
<link rel="stylesheet" href="css/styles.css">
<!-- IE 8 Fallback -->
<!--[if lt IE 9]>
<link rel="stylesheet" type="text/css" href="css/ie.css" />
<![endif]-->
</head>
<body class="boxed bg-cover" style="background-image: url(img/backgrounds/wood.jpg)">
<div class="global-wrap">
<embed type="text/html" src="header.html">
我试着玩CSS设置,但我没有成功。
为什么我总是得到这么长的填充间隙?
我试着玩CSS设置,但我没有成功。
这是一个单独的(无效)文档。<embed>
的功能与(定义不清的)<iframe>
相同。
您缺少Doctype和head
元素。因为没有样式表,所以body元素上有默认的margin/padding