Jump to content

Can I prevent CSS from affecting a .php file that is included in another .php file?


superglidecory

Recommended Posts

I have a .php homepage (called index.php). I have a style sheet linked in it like this:

 <head>
  <link rel="stylesheet" href="styles.css">
</head> 

On my homepage, I have another .php file that is included with:

<?php include 'menu.php';?>

menu.php is being styled by styles.css, and this is something I do not want. Granted, I can change the name of styles.css or maybe make more specific classes and id's, but is there another way to tell php to not be styled by a .css stylesheet? 

Link to comment
Share on other sites

6 hours ago, dsonesuk said:

Give link tag a id and where you don't need it! Style with display: none to that id reference.

 

6 hours ago, dsonesuk said:

Might be better to give menu a class '.ignore_style_css' and use :not('.ignore_style_css') to styling that targets the menu.

I was kinda afraid of that, and so far that's what I've been doing. I wanted something easier than to do something like that, but it does work and its so far the best way of doing things for now. I'm still looking into ways of isolating .php files used by include from .css stylesheets.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...