1

While for a couple of reasons you might have not understood the question from the title let me try to explain what exactly do I have in mind.

Is there any "correct" way of making an entire div a clickable box that would retain it's on-hover CSS properties and would redirect to http://example.com?

I've got a div as simple as this one:

<div class="name">
  What should I be typing here?
</div>

Now the div class is as follows:

.name {
  float: right;
  width: 100%;
  border-top: 1px solid #EEE;
  background: transparent;
  position: relative;
}

And the behavior on hover is:

.name:hover {
  background: #f5f5f5;
  transition-duration: 0.1s;
  transition-property: background;
}

If there is anything missing/wrong with my question, just tell me and I will do my best to correct it/provide more information.

Thanks for the help.

Seth
  • 10,198
  • 10
  • 45
  • 68
BS Studio
  • 11
  • 1
  • You'd either need an anchor in (or around in HTML5) your div to make it a link, or JavaScript to detect a click on the div and handle the redirect. – j08691 Aug 27 '14 at 21:06
  • possible duplicate of http://stackoverflow.com/questions/1827965/is-putting-a-div-inside-an-anchor-ever-correct – Roko C. Buljan Aug 27 '14 at 21:09

0 Answers0