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

  • SEARCH
  • Home
  • 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 3873984
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:05:59+00:00 2026-05-19T22:05:59+00:00

How to make an external PHP widget page have its own CSS. The catch

  • 0

How to make an external PHP widget page have its own CSS.
The catch is – when the external page is included it’s been affected by the stylesheet of the host page.

The included page is actually a comments ‘widget’ (with his own .css file, about 30 lines, not much) and the height and width flexibility are a MUST HAVE.

The PHP include was so far the best solution, but I lost my hair adjusting its CSS file to fit / null (adding/excluding/ styles) any possible host web page.

Example:
if the host page has styles for img borders I have to null them from the widget’s style.css, same for H3, P, and so on.

How would you preserve a widget stylesheet from being affected by the host page styles, beside using iframe?

  • 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-05-19T22:06:00+00:00Added an answer on May 19, 2026 at 10:06 pm

    You know CSS is a client-side thing; it doesn’t know about PHP and how the page has generated on the server.

    You have got to focus on the final resulting HTML and redefine tags and classes and IDs so that your desired style rules apply to right elements.

    You can limit the scope of CSS rules by surrounding that part in a div with a unique ID or class and use it in your CSS selectors so they wouldn’t apply to elements outside of that div.

    Or if you can’t do that you have to use stronger rules to override included ones for your other elements. Which will be a little messy, but you can override styles applied to an element using several techniques like !important or having more selector parts.

    For example, in both of the below samples, the second rule will overwrite the first one:

    #comments .link { color: red; } /* Included page rule */
    #header .link { color: blue !important; }
    

    or

    #comments .link { color: red; } /* Included page rule */
    #header div a.link { color: blue; }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My goal is to make the title of every external link equal to its
Ok, So I have a external php script that get data from a DB
i'm trying to make post to an external url using curl, the externa page
PHP files can be used as external javascript files. Basically make a php file
Say I have info.php page with user info (id, name, age, etc). On this
I want to make a .NET Form as a TopMost Form for another external
How do I make the computer's internal speaker beep in C# without external speakers?
I'm implementing a JAX-WS webservice that will be consumed by external Java and PHP
I have a PHP script that needs to execute programmes that will work on
I'm starting with PHP for dynamic web pages. I have some libraries written in

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.