user4fun Posted October 6, 2010 Share Posted October 6, 2010 I am new to css and I am wondering how to avoid duplicationg the html code. My css page is styling the majority of everything except that there are some html code associated with. For example, I have a big list <ul><li> etc etc that is dictating my drop down menu. How do I use that without haveing to copy/paste the the list code in every htm page? Link to comment Share on other sites More sharing options...
justinbriggs1 Posted October 6, 2010 Share Posted October 6, 2010 If you don't want to use PHP, you can use a server side include. It works like this:Just make the header its own .html file, which includes the doctype statements, CSS include statements, the global menu, etc.Then, when you make a new page, you can include the header file with a server side include:<!--#include virtual="header.html"-->You can put whatever content you want in the new page. You can do the same for the footer, or sidebar, or anything really.An rudimentary About Us page might look like this: <!--#include virtual="header.html"-->Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.<!--#include virtual="sidebar.html"--><!--#include virtual="footer.html"--> I haven't really used server side includes before, as PHP has it's own method of handling includes, but it should work fine. Link to comment Share on other sites More sharing options...
trevelluk Posted October 7, 2010 Share Posted October 7, 2010 Its just worth noting that this is, I think, specific to the Apache webserver, and might not be enabled by all hosting providers. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.