Forum Moderators: not2easy

Message Too Old, No Replies

Nav bars in CSS

Just to know whether to pursue this possibility or not...

         

Hapless

10:51 pm on Jan 15, 2004 (gmt 0)

10+ Year Member



I was wondering if it's possible to make the content of nav bars entirely in CSS. In other words, you would be able to edit the way it is set up in your CSS file and it would change the appearance of the nav bar in all your pages. I hadn't really seen anything like this anywhere, so I decided to ask.

grahamstewart

10:57 pm on Jan 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Depends what you mean.

Do you mean change what links actually appear in the nav bar?
Or just change the appearance of the nav bar itself?

If its the former then I would counsel against it.
A page should be usable with CSS turned off: this is important for search engines, accessibility and more limited internet devices.

If you mean the latter, then sure, thats what CSS is there for.

Hapless

2:16 am on Jan 16, 2004 (gmt 0)

10+ Year Member



I meant change the actual links that appear, but if you warn against it, I probably won't pursue it any. It's just that I keep changing my mind about content, and I didn't want to have to change all the pages to incorporate something new later on. I guess I'll just have to make up my mind and leave it that way.

Purple Martin

2:26 am on Jan 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You should use a server-side include for the nav section. That way, you only have to change one file and the change will be seen across all your pages.

grahamstewart

2:58 am on Jan 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yep Martin is right - you can do stuff like this in PHP (or any other server side language). In PHP it could look something like this..


<body>

<div id="maincontent">
<p>blah blah blah</p>
</div>

<?php include 'navbar.html'?>

</body>
</html>

People often use this technique to add in 'template' code that is the same on multiple pages. Check out the PHP forum if you need more info. :)

Hapless

11:26 am on Jan 16, 2004 (gmt 0)

10+ Year Member



Ok, that's more what I had in mind. I'm learning PHP myself, so I think I'll wander on over there.