I know that there are options to do this manually, such as here : How do you make the entire DIV clickable to go to another page?
However, in Rails 3 we make links like this:
<%= link_to “name”, url %>
And I am wondering — is there a proper Rails way to make a whole div a button. I realize I could make a button. However, let’s say I want to fill it with content like text and a picture – then how would I make that whole div clickable in a rails way?
For example:
<%= @story.title %>
<%= @story.blurb %>
In this example, I would want to make #story clickable, with the rails generated content that I specified.. Any ideas?
For those interested, the answer is:
And then, in the CSS set .class_name to position:relative; and:
The link will now assume the size of its parent container, and thus give the impression the whole container is a link.