如何将不同的HTML部分显示为网站的不同页面

问题描述

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>

<div class="main-container">
    <!--NAVAGATION-->
    <ul class="nav">
    <li><a href="#home"></a>Home</li>
    <li><a href="#about"></a>About</li>
    <li><a href="#robotics">Robotics</a></li>
    <li><a href="#books">Books</a></li>
    </ul>
</div>

<div class="main-content">
    <section class="home section" id="home">
        <!--home page content-->
    </section>
    <section class="about section" id="about">
        <!--about page content-->
    </section>          
    <section class="robotics section" id="robotics">
         <!--robotics page content-->
    </section>
    <section class="books section" id="books">
         <!--books page content-->
    </section>
</div>
    
</div>

</body>
</html>

大家好!我正在使用此结构,并尝试将每个部分链接到其相应的NAV选项,以便仅显示所选内容(作为其他页面)。但是,对于本节中的“ id”属性和NAV选项的“ href”属性而言,它的作用不是太大,因为仅切换页面上的内容,而不切换页面本身。我已经尽力做到了,但这是我所能做到的。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)