-2

I created header footer page called header&footer.html and header&footer.css for styling. I want to connect this page to my other html pages (ex: Home.html, Store.html, ContactUS.html) with different css files. How can I do this?

  • @Alon Eithan of course he can either with addition of JS or by using iframes. the firame conent can eb another HTML page with a different CSS file which is declared in that HTML head. However it is a huge mess and I highly recommend to use PHP include (Template System) or SSI (even more of a mess). – tacoshy Oct 03 '20 at 15:00
  • @tacoshy It's impossible just with HTML AFAIK (OP didn't mention [tag:javascript]) – Alon Eitan Oct 03 '20 at 15:01
  • No its not impossible... iFrame is pure HTML! ` and load another html page into the iframe. – tacoshy Oct 03 '20 at 15:02
  • Good point. Iframe will work, but it's not a good practice – Alon Eitan Oct 03 '20 at 15:04
  • how to use iframe? help me please! – Waruna Shiran Oct 03 '20 at 15:19

1 Answers1

0

I'm not sure if you could do this with .html files. However, you can change your files to .php instead of .html. PHP could still read HTML code as long as it is hosted, local or not. You could use <?php include ('footer.php');?> to include the file to the page.

Jaocampooo
  • 482
  • 3
  • 10
  • 1
    Where did you see any mention of PHP exactly? – Alon Eitan Oct 03 '20 at 14:57
  • 2
    @AlonEitan it was not excluded either. And PHP is the correct method to implement Tempaltes as the OP wanted. – tacoshy Oct 03 '20 at 14:58
  • that is exactly the thing. Such question can only come from a person that does not know about PHp templates. Proberly ebcause he is to new to even start with PHP and has no idea how easy it is. He simply needs to have his file end with .php and add the line `` the rest of the file can be pure HTML. So why not pointing him into the right direction and let the OP chose if he wants to use it or not. Most beginners here, dont even have the slightest clue of all possible method and simply seek for a solution without having to much base knowledge. – tacoshy Oct 03 '20 at 15:21
  • Because for this to be an helpful answer, it should also explain about running a local web server running PHP. I agree that the OP is a beginner and still has a lot to learn - I also thinks that PHP is a good place to start (At least from my experience) – Alon Eitan Oct 03 '20 at 15:25