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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:52:26+00:00 2026-06-06T11:52:26+00:00

What I am attempting to do is to highlight a div with a certain

  • 0

What I am attempting to do is to highlight a div with a certain id, when It has been referred to by an anchor on another page IE:

User clicks link href="qw.html#test", when the page is loaded, then the div with the id="test"
is highlighted so that the user can see it clearly.

I’m sure that I’ve seen a CSS3 example where a div is highlighted if it was linked to.
Or was it JavaScript?

  • 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-06T11:52:28+00:00Added an answer on June 6, 2026 at 11:52 am

    You can use the :target pseudo-class to select an element whose ID exactly matches the "fragment" part of the URL (the part after the # which jumps to a named anchor within the page).

    So for example, the following rule would apply to any element that you jump to with a URL fragment:

    :target {
       background-color: #ffa;
    }
    

    JS Fiddle demo.

    And the following rule would apply to a DIV called john, but only when the fragment in the current URL is #john (the fragment is the same as the ID of the DIV):

    div#john:target {
       background-color: #ffa;
    }
    

    If you click a link within the page which changes only fragment part of the URL, then the element selected by the :target pseudo-class will change.

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

Sidebar

Related Questions

Attempting the most basic example of Knockout.js possible on their documentation page: http://knockoutjs.com/documentation/observables.html Looks
I'm attempting to create an inline textarea, where a user clicks a paragraph of
Attempting to build a C# project which has numerous references to assemblies in NuGet
I am successfully using RJS to implement AJAX on a page.replace.html create.js.rjs. I am
I've been constantly attempting to adapt a perfect string matching expression for my syntax
I'm attempting to install PyLucene 3.0.3 on Ubuntu 10.04. This has proven considerably challenging,
I'm attempting to sort of highlight a tile object within a game I'm making
I am attempting to have the user take a picture of something containing text
Attempting to use the data series from this example no longer passes the JSONLint
Attempting to make a NSObject called 'Person' that will hold the login details for

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.