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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:16:26+00:00 2026-06-17T15:16:26+00:00

So, What basically I am trying is after clicking on <a> anchor tag I

  • 0

So, What basically I am trying is after clicking on <a> anchor tag I want to change the background of it.

Example : See image below

Arrow Image before expanding

After clicking on this link I am generating (expanding) one div tag exactly below to it and displaying the polices on it.

I want to expand arrow turn when expanding/collapsing like :

See Image below: Image Name: (black_t_arrow.gif)

Arrow for policies after clicking on it

So that It will display image down arrow image when policies link is collapsed and again vice versa after clicking on Policies link it should hide that down arrow image with original one means it should return to the previous state.

Following is my CSS code:

.expended_div{ float:left; width:100%; padding:10px 0}
.expended_div a{ color:#000; font-size:11px; text-decoration:underline; margin-left:15px; font-weight: bold; background-image: url("/common/images/black_t_arrow.gif");
                 background-position: 0 2px;
                 background-repeat: no-repeat; padding-left: 9px;}
.expended_div a:hover{ text-decoration:underline}
.expand_collapse{ float:left;  padding:10px 20px; }

Following is HTML code:

<p class="expended_div open"><a href="#">Policies</a></p>
    <div class="expand_collapse" style="display:none;">
        <p><?php
      //some php code
    }
    ?></p>
    </div>

How can I achieve this using CSS?

Thanks in advance.

  • 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-17T15:16:27+00:00Added an answer on June 17, 2026 at 3:16 pm

    You need two CSS classes, one for the collapse and one for the expanded.

    HTML:

    <a id="expander" class="close" href="#">Click to collapse/expand</a>
    

    CSS:

    .close { background-image: url("/images/collapsed.gif"); }
    .open { background-image: url("/images/expanded.gif"); }
    

    JavaScript:

    /* Useful for multiple CSS classes. */
    $('a#expander').click(function(e){
        e.preventDefault();
        var exp = $(this);
        if (exp.hasClass('open')) {
            exp.removeClass('open').addClass('close');
        } else {
            exp.removeClass('close').addClass('open');
        } 
    });
    

    OR:

    CSS:

    a#expander { background-image: url("/images/collapsed.gif"); } /* set default image */ 
    .open { background-images: url("/images/expanded.gif"); }
    

    JavaScript:

    /* Swap in/out the class open to override the default background. */
    $('a#expander').toggleClass('open');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm basically trying to accomplish the following. I want it so 5 seconds after
Sorry, I am new to coding and I can't figure this out after trying
Scala Newbie alert: basically I'm trying to do something like this: where I pattern
I posted this elsewhere bus was unable to get help. So basically I'm trying
<body onload=document.getElementById('menuTest').style.removeAttribute('display')> This is the code I'm using. Basically I'm trying to make an
I'm trying to select everything but the thing I'm currently clicking on. Basically, I
I'm basically trying to grab everything after the 4th segment in the URL, however
I'm basically just trying to submit a form through AJAX and want to show
I'm trying to basically trying to separate a specific amount of text from the
I'm basically trying to iterate through a dict and print out the key /

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.