I was trying to get an entire <li> row to be clickable rather than just the text inside it. So I put the <a> tags on either side of the <ul> tags and it works. My question is: is this correct usage, or am I heading into trouble later? Here's the complete test HTML:
HTML Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <style type="text/css"> h2, p{ font-family:Arial, Helvetica, sans-serif; } .outer { margin:0;padding:0; position:relative; display:table; height: 100px; width: 200px; vertical-align: middle; text-align: left; border: 1px solid #000; background:#bbb; clear: both; } .inner { margin:0;padding:0; display:table-cell; vertical-align:middle; position:relative; border: 1px solid #ff0000; padding-left: .6em; } .inner a { color:blue; text-decoration:none; } </style> </head> <body> <h2>Vertical alignment of elements of different heights</h2> <p>Putting the < a > tags around the < ul > tags allows the whole < li > row to be clickable instead of just the < p > text.</p> <a href="#" alt=""><ul class="outer"> <li class="inner"> <p>This is some random text</p> </li></ul></a> <a href="#" alt=""><ul class="outer"> <li class="inner"> <p>This is some random text<br>This is some random text</p> </li></ul></a> <a href="#" alt=""><ul class="outer"> <li class="inner"> <p>This is some random text<br>This is some random text<br>This is some random text</p> </li></ul></a> </body> </html>



Reply With Quote






.

Bookmarks