paddyhaig Posted May 13, 2010 Share Posted May 13, 2010 Is it possible to use an entire div layer as an active link? Quote Link to comment Share on other sites More sharing options...
andrewgauger Posted May 13, 2010 Share Posted May 13, 2010 <DIV onClick="javascript:window.location='home.html'"> click me</div> Quote Link to comment Share on other sites More sharing options...
jacko310592 Posted May 13, 2010 Share Posted May 13, 2010 as above; or if you wanted a CSS solution, you could put an Anchor inside of the div and strech it to 100%, you would need to add a display propety to the <a> of display:block though for this to work (as far as i am aware), see below: HTML: <div> <a href="mysite.com"> Click Me more content, blah blah blah blah... </a> </div> CSS: div { height: 200px; /*or whatever*/ width: auto; /*or whatever*/ } div a { display: block; /*to allow width and height manipulation*/ height: 100%; /*entire height of div*/ width: 100%; /*entire width of div*/ } hope this helps Quote Link to comment Share on other sites More sharing options...
andrewgauger Posted May 13, 2010 Share Posted May 13, 2010 Does that work with scripting disabled? It looks like it would. Interesting solution. Quote Link to comment Share on other sites More sharing options...
jacko310592 Posted May 14, 2010 Share Posted May 14, 2010 yes, noscript users should have no problems with it (: Quote Link to comment Share on other sites More sharing options...
haku Posted May 14, 2010 Share Posted May 14, 2010 I use that method (and/or variations of it) regularly. Works well, and is valid code. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.