Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8590455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:17:53+00:00 2026-06-11T23:17:53+00:00

What are the benefits of using a CSS external stylesheet over a php file

  • 0

What are the benefits of using a CSS external stylesheet over a php file set to content-type: text/css? If you place this header at the top of a PHP file I feel like you have so much more potential:

<?php
    header("Content-type: text/css");

    if($query_string = "contact_us") {
        #nav {}
    }
?>

(^ that’s a .php file). http://shapeshed.com/using_php_to_enhance_css/

If there are no downfalls (and I checked how they were cached in Chrome’s Network Panel and I believe it’s the same), isn’t it kind of like whether to use .html or .php?

Thanks for any feedback.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T23:17:54+00:00Added an answer on June 11, 2026 at 11:17 pm

    Here are some differences:

    • PHP will create extra CPU / memory overhead compared with serving purely static CSS. Probably not all that much, but still a consideration. The more processing you do the bigger a deal it is, obviously.
    • You can’t push PHP files to a CDN
    • SASS and LESS have been developed to deal with any dynamic features you might need so PHP isn’t likely necessary
    • Sounds like you’re worried about serving more CSS than is needed for certain pages. Realistically it’s not an issue since browsers will cache the CSS after the first download.

    Additional thoughts:

    I wrote a UI template engine that isolates both JS and CSS code to only the specific views on which they are used. If a CSS or JS is used more than once, it is pushed to the “kitchen sink level” and included globally. This limits selector conflicts and also best balances the number of HTTP requests and total download size per request. Also keeping relevant code (i.e. button event listeners or page / element-specific styles) close together helps with more rapid programming, especially for non-expert teams / developers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the real benefit of using external css and js in place of
I'm just trying to get into the benefits of using CSS vs. tables, but
Is there any performance benefits to using Command objects to validate constraints over using
Using pure functional languages can have a lot of benefits over using impure imperatives,
From my previous questions about gettext, one of the biggest benefits of using PHP's
I'm sold on the benefits of using Nicole Sullivan's Object-Oriented CSS philosophy/coding methodology/whatever. In
Possible Duplicate: Benefits of using the conditional ?: (ternary) operator hi, I'm viewing this
Benefits of SPATIAL over BOUNDING What are the benefits of using a SPATIAL query
What is the practical benefit to keep CSS 100% validated (not using any hacks),
Are there any benefits of using the following code? <ul role=list> <li role=listitem></li> <li

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.