Jump to content

[SOLVED] Two CSS Files on XAMPP Server


c-o-d-e

Recommended Posts

I have two CSS Files needed for some pages

<link href="styles/twoColLiqRtHdr.css" rel="stylesheet" type="text/css" />
<link href="styles/style.css" rel="stylesheet" type="text/css" />

 

twoColLiqRtHdr.css works fine, but style.css doesn't actually.. work. It looks like XAMPP can only use 1 css file.

 

Any ideas?

Link to comment
Share on other sites

XAMPP does not have anything to do with CSS working (unless the apache server settings on how to handle css are messed up, which I doubt cause you would of had to mess them up). Chances are the file is not at the specified location...

 

HTML gets parsed by the browser, not the server. Now if the file is not at http://yourserver/styles/style.css  then it will not work. Check to make sure that the style sheet is in that folder and not somewhere else.

Link to comment
Share on other sites

The problem is though.. I can access the CSS here..

http://localhost/styles/style.css

 

Why is that a problem? Basically what that means is that either you are viewing a cached version of your site or somewhere in your code something is messing up. Either in styles.css or twoColLiqRtHdr.css possibly have some issues on their own, or even in the file displaying those css styles has an issue.

 

Given that the first style sheet works, my bet is on that you have an issue in your CSS code that is preventing the other stylesheet to display properly. Perhaps try validating your CSS pages via: http://jigsaw.w3.org/css-validator/ to make sure your sheets are valid and there are no fatal errors in them?

 

It is really hard to tell just from that, the known fact is, it is not XAMPP causing the problem :) It is somewhere in the code/stylesheets/html.

Link to comment
Share on other sites

yeah but which folder is the script file that contains the link in.

 

seen as you can work from site root for that try changeing it to this:

 

<link href="/styles/style.css" rel="stylesheet" type="text/css" />

 

but we really need to know where you have placed the script that your html is contained in so that we know what the path should be in relation.

 

p.s. the styles might be being overided.

Link to comment
Share on other sites

I checked CSS Validator, and it comes up as:

Congratulations! No Error Found.

 

All the pages except CSS are found - C:\xampp\htdocs

And for CSS - C:\xampp\htdocs\styles

Exactly as it is on the production server - Which works

 

I tried it as "/styles/style.css" which never worked either.

 

Any other possibilities? What sensitivities are there in XAMPP.

EG: <? and <?= aren't recognised in XAMPP.

What about for div's who use a style sheet.

 

If I have <div class="whatever" id="table">

And <div class="style" id="table">

Would that be overided?

Link to comment
Share on other sites

Any other possibilities? What sensitivities are there in XAMPP.

EG: <? and <?= aren't recognised in XAMPP.

 

That is not recognized by XAMPP because of how XAMPP configures PHP, you can easily make those allowable by modifying the PHP.ini file, that is a php configuration.

 

As far as div's / styles etc. The web server does not care about that, that is all HTML markup which is done on the client side not server side. Now the reference to the .css files do matter, try writing in the full absolute path to the style sheets and see if they work.

 

As far as the overriding, if style.css has the same styles called as the prior sheet it will take precedent over them since it was last to be executed (I believe that is how it goes). The chances are the issue lies within your html code / location of files on the server. Post your current HTML for the page you are trying to style that is not working so we can look at what might be causing the issue.

 

Alternatively, if you are using FireFox you can use the Developer tool to see errors with Javascript and some errors with CSS that maybe happening. (I believe it is located under Tools > Error Console) You may have to clear it out then refresh the page.

Link to comment
Share on other sites

Ok, thanks for explaining :)

 

I checked where the problem was in the website file which uses

<? include 'mcommands.php' ?>

Which mcommands was where it uses the style.css

I changed it to <?php

.. I couldn't believe this was the problem considering I found out this was a problem on another thread.

 

Thanks for trying to help.

 

Link to comment
Share on other sites

.. I couldn't believe this was the problem considering I found out this was a problem on another thread.

 

:) Which is why posting some code would have saved some headache. I would suggest it for the next problem as it helps us to see where the real problem is instead of going on wild tangents that have nothing to do with the original problem.

 

Just an idea!

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.