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
  • 7,794
  • 19
  • 28
  • 47
Max Frai
  • 57,874
  • 75
  • 193
  • 301

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
  • 130,553
  • 41
  • 252
  • 283
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
  • 62,241
  • 100
  • 265
  • 409
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
  • 66,813
  • 19
  • 139
  • 194
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
  • 259,174
  • 73
  • 529
  • 557