Jump to content

[SOLVED] Exclude from CSS


ldsmike88

Recommended Posts

I have a javascript menubar at the top of my page that defines the colors and everything for the font of the menubar, but when I look at it online the font colors and sizes are different because my css file overwrites the javascript when it displays it. Is there anyway to exclude that area of the page from the css file? Maybe php could help somehow...

Thanks!

 

Michael

Link to comment
https://forums.phpfreaks.com/topic/38173-solved-exclude-from-css/
Share on other sites

You could go into the CSS and

 

A) Comment out that code block

 

B) If some other code requires that bit of CSS, then rename that CSS block to something else then go to to the code that requires it and rename it to match.  Then delete the problem block and use your javascript.

You can start using php by typing '<?' and you can close it by typing '?>'. Can you do the same thing with css? Something like <link href="index.css" rel="stylesheet" type="text/css"> to open it and </link> to close it? Is that possible?

 

But I'm not really commenting in css.

For example:

 

<html>
<head>
<link href="../index.css" rel="stylesheet" type="text/css" />
</head>
<body>
<script type="text/javascript" src="../javascript/admin.js"></script>
//Everything else.
</body>
</html>

 

How do I apply the css to the "Everything else" but not to the javascript? Sorry for suck a stupid question but I don't know what to do.

The javascript writes text in html so it gets the css applied to it.

 

But apparently it writes out bare HTML, as opposed to HTML with classes or ids.

 

You need to make it output the HTML with classes or ids in order to style them individually. Also, they will inherit from the parent style unless you override it with a new style in the CSS declaration.

Archived

This topic is now archived and is closed to further replies.

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