CSS Navigation Bar - Should I bother with PHP?


I am designing a PHP site. I am designed a site navigation bar using PHP.

But the horizontal navigation bar will be CSS… I may use a drop down horizontal navigation bar. I have designed this using CSS and see no reason to rebuild it using PHP.

As I am designing the rest of the web site using PHP would you recommend I use PHP to build the CSS horizontal menu???!?


You can only build a navigation bar with HTML, not PHP or CSS. You can manage it with PHP and style it with CSS, but it’s still basically HTML. Of course you need to style it with CSS. And it’s a good idea to add it to your pages via an include, so that you only have to edit it in one place. If it makes like easier for you to construct the menu on the fly with PHP, then go for it, but given that menus are pretty static, there doesn’t seem much point to me.


If you want a lot of php functionality on your page then you can use require_once() functionality to include an html menu. You can work on your html menu separately and style it with css. Then include it using require_once() like:

<?php require_once('menu.html'); 
/*other php here*/