简体   繁体   English

如何通过链接到桌面和移动设备上包含 HTML 代码的一个文档,在多个 HTML 文档中显示我的导航栏代码?

[英]How can I display my Navbar Code in multiple HTML documents by linking to one document containing the HTML Code on Desktop and Mobile?

I have a blog type website I am creating and I would like to have the code for my navbar appear on multiple pages on the website, but be linked from one file.我正在创建一个博客类型的网站,我希望我的导航栏的代码出现在网站的多个页面上,但从一个文件链接。 I would like it to be linked in the same way that CSS & Javascript documents are linked to an html document.我希望它以与 CSS 和 Javascript 文档链接到 html 文档相同的方式链接。

I am a bit new to webcoding so I apologize in advance if I do not explain something properly and I am happy to clarify if anyone has any questions我对网络编码有点陌生,所以如果我没有正确解释某些事情,我会提前道歉,如果有人有任何问题,我很乐意澄清

The website is using HTML, CSS, Javascript and Bootstrap 5 CSS & Scripts.该网站使用 HTML、CSS、Javascript 和 Bootstrap 5 Z2C56C360580420D293Z&72F4。 I'm open for using other coding languages if that is recommended.如果推荐的话,我愿意使用其他编码语言。

I'm open for using other coding languages if that is recommended.如果推荐的话,我愿意使用其他编码语言。

Than I would suggest using a server-side language for it.比我建议使用服务器端语言。 PHP could be very easy: PHP 可能非常简单:

Your main file (index.php) should be something like this:你的主文件(index.php)应该是这样的:

<html>
<head>
    <!-- Title & meta tags, etc... -->
</head>
<body>
    <?=include("header.php"?>
    <!-- Unique page content goes here -->
</body>
</html>

and inside the file header.php just throw your navbar.并在文件 header.php 中扔你的导航栏。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何通过我的 HTML 或 JavaScript 代码在移动设备上强制桌面视图 - How can I Force desktop view on a mobile device from my HTML or JavaScript code 如何在移动模拟器中查看HTML网页并提高代码效率? - How can I view my HTML webpage in a mobile emulator and make my code more efficient? 如何通过使一行代码成为HTML代码来最小化? - How Can I minimize the HTML code by making it one line of code? 如何从此代码自定义移动和桌面显示的警报框? - How can I customised alert boxes for both mobile and desktop display from this code? 如何在页面内显示和格式化HTML代码? - How can I display and format HTML code within the page? 使用包含内联脚本的HTML代码替换完整的HTML文档 - Replace complete HTML document with HTML code containing inline scripts 如何以HTML显示此代码? - How do I display this code in HTML? 如何将我的“桌面视图”html文件与我的“移动视图”jQuery移动文件相结合? - How do I combine my “desktop view” html file with my “mobile view” jQuery mobile file? AngularJS-如何格式化包含一系列数字的字符串以在HTML表格上显示为列表? - AngularJS-How can I format a string containing a series of numbers to display as a list on my HTML table? 如何在HTML和PHP中实现此JS代码? - How can I implement this JS code in my HTML and PHP?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM