2016-11-23 23 views
1

我想將我的網頁的所有組件都放入單獨的文件中。例如,我想將我的Navigationbar.html重要放到當前版本中,這樣如果我想編輯導航欄,則不必在所有已製作的頁面上對其進行更改。如何將網頁的組件保存在單獨的文件中

有沒有辦法讓我管理它在一個單獨的文件,然後調用它,使它出現在我當前的HTML頁面。例如:

<body> 
<import banner.html> 
<import navigationbar.html> 
<p>Hello world</p> 
</body> 
+0

這可能會感興趣:http://webcomponents.org/articles/introduction-to-html-imports/ – winseybash

+0

@winseybash [html imports](http://caniuse.com/#feat=imports)是不行的,所有主要供應商都表示他們不會考慮實施到期在當前的兼容性問題佩奇。 – cfreear

回答

0

一個<iframe>標籤可以做到什麼你想要做的事:

<iframe src="http://example.com/"></iframe> 
 
<p>Hello, World!</p>

相關問題