问题在独立文件中创建菜单

时间:2017-04-27 13:30:11

标签: html menu

我想在一个单独的文件中有一个菜单,所以我可以在多个页面中调用和使用,如果我需要修改菜单,我只需要在一个地方修改。

这就是我所做的。

我创建了一个HTML文件(这将是调用菜单的任何页面)

<html>
<body>
<iframe src="TopMenu.html">   </iframe> 

This is the main site. I can have any page / content here

</body>
</html>

上面的页面正在调用TopMenu.hmtl文件,其中我有我的菜单代码。代码如下:

<html>

<style>

.topnav {
    background-color: #333;
    overflow: hidden;
}

.topnav a {
    float: left;
    display: block;
    color: #f2f2f2;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
    font-size: 17px;
}

/* Change the color of links on hover */
    .topnav a:hover {
    background-color: #ddd;
    color: black;
}

/* Add a color to the active/current link */
.topnav a.active {
    background-color: #FF9900;
    color: white;
}
</style>

 <div class="topnav" id="myTopnav">
<a class="active" href="www.Myweb/Home.html">Home</a>
<a href="www.Myweb/ContactUs.html">Contact</a>
<a href="www.Myweb/about">About</a>
</div>

</html>

问题: 1.我在下面的图像(1)中看到了代码,我希望看到菜单栏覆盖整个页面宽度(从左到右)

enter image description here

  1. 当我点击菜单中的其中一个链接时,我会看到如下所示的新页面(如同菜单框内部),而我希望看到一个新的完整页面
  2. enter image description here

    非常感谢您的帮助

0 个答案:

没有答案
相关问题