0
Some text
.sliderPart {   
    width: 25%;
    height: 100%;
}

.sliderPart a {
    display:block;
    position:relative;
    text-decoration:none;
    height: 100%;
    font: 1.3em  Arial, Sans-serif;
}  

How can I make my link clickable for all div-area?

niton
  • 8,771
  • 21
  • 32
  • 52
Max Frai
  • 61,946
  • 78
  • 197
  • 306

4 Answers4

2

The easiest thing is to remove the div altogether:

<a href="#computers" class="sliderPart">
   <strong>Some text</strong>
</a>

a.sliderPart {
  ...
}
Kobi
  • 135,331
  • 41
  • 252
  • 292
1

Try this:

$(".trigger").click(function() {
    window.location = $(this).find("a").attr("href");
    return false;
});

..you'd also need to give cursor: pointer to the clickable element.

eozzy
  • 66,048
  • 104
  • 272
  • 428
0

Put the link outside the div. You can make an anchor tag act similarly to a div. Like you're doing in the css you posted.

Ólafur Waage
  • 68,817
  • 22
  • 142
  • 198
0

For dropdown lists, I use the following method a lot...

If you're not opposed to using scripts, you can make the div itself a proxy of sorts, so that if you click anywhere on the div, the first link within that div is subsequently clicked automatically.

$(".sliderPart").bind("click", function(){
  $("a:first", this).trigger("click");
});

Of course you would want to update your styles for the div when you mouse over it to indicate the entire thing is clickable.

Sampson
  • 265,109
  • 74
  • 539
  • 565