Search code examples
uinavigationbarstylesheetexternal

Is it possible to link to an external html sheet?


Is it possible to add an external sheet containing html elements (similar to an external css stylesheet) maybe using the link tag?

The project will have many webpages that have identical elements (for example, a navigation bar) Is there a way I would be able to link to an external file so that I would only have to change one file to spread this change to all of my webpages.


Solution

  • Using just plain HTML, no. Some other options:

    • You can use a server side scripting language to include files. (Language specific)
    • Server Side Includes. SSI's are rather limited however.
    • Templates or Templating Engine (like Smarty). This is the overkill solution to a simple problem, but left here as an option.
    • Javascript can dynamically generate the content after the page loads.
    • Depending on your content, sometimes an IFRAME can be used.