Table Of Content
- You can’t make the div a link itself, but you can make an <a> tag act as a block, the same behaviour a <div> has.
- Requires a little javascript. But, your div would be clickable.
- This is a “valid” solution to achieving what you want.
- HTML
- CSS
- Open in new window
- Open in same window
- The code
- This is one of the solution
- Try this code
- You can give a link to your div by following method
- You can make surround the element with a href tags or you can use jquery and use
- We have a <div> block with some fancy visual content that we don’t want to change. we want to make it a clickable link.
- It something like <a href=”…”><div> … </div></a>, but that is valid XHTML 1.1.
-
You can’t make the div a link itself, but you can make an <a> tag act as a block, the same behaviour a <div> has.
You can then set the width and height on it.
-
Requires a little javascript. But, your div would be clickable.
-
This is a “valid” solution to achieving what you want.
But most-likely what you really want is to have an <a> tag displayed as a block level element.
-
HTML:
-
CSS:
Open in new window :
- Here’s how to make a div into a clickable link that will open the target URL into a new window.
[ad type=”banner”]
Open in same window :
- Here’s how to make a div into a clickable link that will open the target URL into the same window.
-
The code :
- You could also try by wrapping an anchor, then turning its height and width to be the same with its parent.
-
This is one of the solution :
[ad type=”banner”]
-
Try this code :
-
You can give a link to your div by following method:
[ad type=”banner”]
-
You can make surround the element with a href tags or you can use jquery and use
