rayigen85
rayigen85

Reputation: 11

Same content on many different Websites

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.

Upvotes: 1

Views: 53

Answers (2)

raymondluker
raymondluker

Reputation: 1

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.

Upvotes: 0

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

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

Upvotes: 2

Related Questions