简体   繁体   中英

How can I include a navigation.css and .html in all pages?

I have a fixed and seperate navigation and footer file (html, css) and I want to know how to include them in all pages without inserting all codes in all page. I mean how can I link them in all other pages.(Just with HTML,CSS and JS)

You could load the html file into an element using jquery.

By specifying a relative path

$("#footer").load("./footer.html");

or loading it from a url:

$("#footer").load("http://yoursite.com/footer.html");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM