Jump to content

Css Meets Php


Recommended Posts

I have a web page with a php include for the header, another for the footer, the right menu, left menu and a sales banner.

How many CSS links do I need really?



Right now the page is all white, but I want the flexibility to change it in the future. Maybe I have a fancy logo made in March and want an orange background.


So the question is, do I need a CSS link in all of the php include files that are being called including my header, footer, menus, etc. Wouldn't those other php files show as a white background when I change the header's CSS?



Is there a best way to make it universal and life easier (css control); something that you are using?


My theory is to create css.php and have an include inside an include. My css.php file will control all of the other .php files style sheets.


Do I have a winner? Or do you see a pitfall with load time or something else I'm missing? I'm going ahead right now, but jump in if you see a better way.

Edited by thedesignstudent
Link to comment
Share on other sites

You have me confused.


The header, body and footer php files contain the information on page layout. The CSS file contains the style (how the text on the page is rendered, color, size, etc...)


You call the CSS file in your header file. Any changes made to the CSS will be used in you header, body and footer pages.

Link to comment
Share on other sites

As Bruce said if you put the CSS link in your header.php file it will be accessible to the rest of your php files that are included


what you need to think of is that when you include a file in PHP it is basically making one bigger file with all the separate file elements in one... they are essentially no longer separate pages.


so if you include your CSS in the header.php and use one of your CSS styles in your footer, then it will work

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...