1

I have to create a website and on every page I have a top nav bar. Acctualy I have 10 sites and when I have to change the content of the NavBar, I have to change it in every single site.

What is here best practice?

I have tryed to create a js file with the NavBar inside (document.write"".....), but with this solution I have to convert the html code into JS code and this is not my favorite solution?

Is there an better way?

Thanks for answer.

rayigen85
  • 11
  • 2

2 Answers2

2

I think you should create a navbar.html file, contain the code of your nav bar, then

    <?php
         include 'navbar.html';
     ?>
0

First you can use media in css ,

The @media rule is used in media queries to apply different styles for different media types/devices.

In my words, you can give different style based on screen's width.

The Second method is The Browser Object Model. BOM, screen.width can return you the width of the current browswer's width.