Can Nav styling be put into its own CSS stylesheet?

Is it possible to separate my nav markup styling into its own CSS stylesheet? I think the answer is NO because I do not see how a page can respond to two different style sheets. However, I could be wrong.

I have - out of necessity - nav HTML in each of my pages and have its styling in three different CSS stylesheets. My website is setup into three broad categories: one home page, several major pages and several minor pages. The home, major and minor pages are each styled with their own stylesheets each of which also contains identical nav styling. If there were a way to put all of this nav styling into its own separate stylesheet it would really simplify its maintenance and prevent mistakes when making changes or improvements.

Any suggestions or comments are most welcome.

Thanks!

You can have it all in one stylesheet, split it up into separate ones, have more than one stylesheet linked in one page, whichever way suits you really. All you have to be careful of is in ensuring that individual stylesheets are not stepping on each others’ toes. It’s also worth noting that having multiple separate files for the browser to download means more calls to the server and potentially an impact on the performance of the page in terms of how long it takes to fully render.

If you don’t want to link to two stylesheets in the HTML then you can use @import to attach one stylesheet directly into the other.

@chrisofarabia

Thank you very much for your suggestions. I am aware of the possible lag in download time, but I think I will try using multiple stylesheets because my nav menu appears slightly different dependent on what type (home, major, minor) page you are on. I am fully aware that this is due to different - non-intentional - nav styling and having only one style sheet will prevent this duplicity.

Thanks again for you help.

@felgall

Thank you for your suggestion. I will test both linking and @import and see if I can determine which is the fastest.

Thanks again.

@chrisofarabia
@felgall

Just another quick Thank You! for your help. I now have the (complicated) nav styling safely in its own style sheet and the website is running smoothly. This is a huge weight off of my shoulders.

I sincerely appreciate your help.

Pizza’s on the way!!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.