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 8902719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:41:04+00:00 2026-06-15T01:41:04+00:00

In my html page, I use a PHP include to insert my site-wide header:

  • 0

In my html page, I use a PHP include to insert my site-wide header:

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

Here is the code in header.php:

<div id="header">
    <div id="navigation">
            <ul>
                <li><a href="index.php" class="active">home</a></li>
                <li><a href="about_us.php" id="nav_about">about us</a></li>
                <li><a href="competition.php" id="nav_competition">competition</a></li>
                <li><a href="media.php" id="nav_media">media</a></li>
                <li><a href="sponsors.php" id="nav_sponsors">sponsors</a></li>
                <li><a href="contact_us.php" id="nav_contact">contact us</a></li>
            </ul>
        </div>  
</div>

Here is the CSS in the header of the HTML document:

#nav_about { color:#4c005c; }

The “active” class in the inserted code is to change the color of that link to signify what page you are on. That functions fine, as “active” is defined in the CSS document linked to the html file. I want to modify the color of a particular link depending on what page it is included in. Thing is, the CSS on that page (the one defining #nav_about) does not apply when I test it out. The include works fine though.

In summary, I need to find a way to modify a site-wide snippet of HTML that is inserted via a PHP include with CSS on that page it is inserted in.

I am new to HTML and PHP, so I assume it is some lack of knowledge here.

  • 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-15T01:41:05+00:00Added an answer on June 15, 2026 at 1:41 am

    Sounds like a selector specificity issue. What’s the CSS for your navigation links?

    If it’s something like #navigation li {color: #abc}, that will take priority over the #nav_about selector.

    Selector specificity is ranked by the number of ids, classes, and elements in each.

    1 id + 1 element > 1 id.

    Increase the specificity of the #nav_about selector (e.g. change it to #navigation #nav_about) and you should be fine.

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

Sidebar

Related Questions

Here's the code: <?php // For use in creating individual page $tpl_file = submission.php;
The problem: I want to use PHP include to import file header_menu.html into all
Update: The index.php file here: /public_html/d/index.php includes: /public_html/d/core/source/class.File1.php This Class.File1.php here has this include
If i make a menu nav in html and use PHP to include it
I have a page news.html which is php included in my index.html - inside
I had the following HTML page rendering to use the Google Maps API. This
I use WebView + addJavascriptInterface to control my app from html page shown in
I had created one HTML page for my experiance. In this i had use
I am trying to use html5lib to parse an html page in to something
I'm trying to use WWW::Mechanize to extract some links from the HTML page using

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.