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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:03:30+00:00 2026-05-27T19:03:30+00:00

Kindly go through this link and notice the solution given by "thepeer": https://stackoverflow.com/a/3494108 I

  • 0

Kindly go through this link and notice the solution given by "thepeer": https://stackoverflow.com/a/3494108

I am having trouble understanding his solution. Let me illustrate with the example of a webpage that I am trying to build. I am using HTML5 to build "buttons". Now since these buttons are actually DIV objects, I somehow need to make them "clickable" which would lead the viewer to another page, and that too, without making the "link" visible. The div object should act as a button and I don’t intend to "include" a hypertext-ed line of text inside the button.

I think the solution given by "thepeer" does exactly that but i am unable to understand his solution and implement it. Perhaps a very small example would benefit me.

Suppose this is the button that i want to make :

<div id="music" class="nav">
    Music I Like 
    <span id="hyperspan"><a href="Music.html"></a></span>
</div>

And here’s the CSS as "thepeer" suggested :

.hyperspan
{
    position:absolute;
    width:100%;
    height:100%;
    left:0;
    top:0;
    z-index:1;
}

Now, obviously, I misunderstood his solution and hence my above attempt is incorrect. I don’t want to resort to javascript so please help me! Sorry for my noobish-ness.

  • 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-27T19:03:31+00:00Added an answer on May 27, 2026 at 7:03 pm

    There are two solutions posted on that page. The one with lower votes I would recommend if possible.

    If you are using HTML5 then it is perfectly valid to put a div inside of a. As long as the div doesn’t also contain some other specific elements like other link tags.

    <a href="Music.html">
      <div id="music" class="nav">
        Music I Like
      </div>
    </a>
    

    The solution you are confused about actually makes the link as big as its container div. To make it work in your example you just need to add position: relative to your div. You also have a small syntax error which is that you have given the span a class instead of an id. You also need to put your span inside the link because that is what the user is clicking on. I don’t think you need the z-index at all from that example.

    div { position: relative; }
    .hyperspan {
        position:absolute;
        width:100%;
        height:100%;
        left:0;
        top:0;
    }
    
    <div id="music" class="nav">Music I Like 
        <a href="http://www.google.com"> 
            <span class="hyperspan"></span>
        </a>   
    </div>
    

    http://jsfiddle.net/rBKXM/9

    When you give absolute positioning to an element it bases its location and size after the first parent it finds that is relatively positioned. If none, then it uses the document. By adding relative to the parent div you tell the span to only be as big as that.

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

Sidebar

Related Questions

After going through so many documents and online content like: http://stackoverflow.com/questions/4066167/sencha-touch-or-jquery-mobile http://stackoverflow.com/questions/5093691/sencha-touch-vs-jqtouch-vs-gwt-mobile-vs-xui-vs-jquery-mobile-vs http://www.quora.com/Were-deciding-between-jQuery-Mobile-currently-in-alpha-and-Sencha-Touch-What-are-the-pros-and-cons-for-each http://interfacethis.com/2011/adventures-in-html5-part-one/
With some kindly help from StackOverflow, I've got Unity Framework to create my chained
I'm very new to js so kindly help me with this. I am trying
I am new to this field. So kindly go easy on me. I have
If this is answered somewhere else, kindly smack me and point me in the
Link : http://designbracket.com/ . Click on Our Services and the links under it. I
I'm having some trouble choosing between PayPal's Instant Payment Notification (IPN) and Payment Data
I am studying the boot process in Linux. I am looking through this html
Please go through the code below. String[] Info contains 2 values like this: shiftDirection
I was going through operator precedence section of php.net and came across this example

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.