Jump to content

Styles Carrying Over Through Php Pages


summersurfer

Recommended Posts

Hello Everyone,

    I am working on a website with several hundred pages. The way some pages are displayed is as follows:

<body>
<?php require_once('header.php');

require_once($_GET['pageId']);

require_once('footer.php'); ?>
</body>

 

This works fine. But in the footer page I have some styles set like the following:

<style>
a:link { 
font:Arial, Helvetica, sans-serif;
text-decoration:none;	
font-size:12px;
color:#FFFFFF;
}
</style>

 

For some reason, this footer page is overwriting the global css file that the main page uses. Is there some way to keep the style for the footer controlling only the footer and not have it change the middle page that the php is loading?

 

I am guessing the reason this is happening is because the footer is loaded once and then all its formatting is overwriting the middle php page as it is reloaded. I know this sounds really confusing but hopefully someone can make sense of it. I want the footer styles to stop chaning the other php pages.

Link to comment
Share on other sites

This is kinda an html/css question, not really php.

 

Here's what you need to do, all the links that you need changed in the footer, give them class="footer"

 

Then in your global style, add a link of this type:

 

a:link.footer { 
font:Arial, Helvetica, sans-serif;
text-decoration:none;	
font-size:12px;
color:#FFFFFF;
}

 

This will affect all links of the class "footer" and not all links (don't forget to put this below all the global css styles)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.