简体   繁体   中英

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.

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM