Make Anything a Link

In HTML any block or inline element can be a link.  Just stick in inside a pair if ‘A’ tags.  This is particularly useful for making menus and other UI elements.  You can then use the various :hover, :focus and other pseudo-classes to apply styles that make plain vanilla text based HTML work like a fancy image based GUI.  Here’s a quick little example:

 <style type="text/css">
   body {
     background-color: #888888;
   div {
     background-color: red;
     width: 200px;
     height: 200px;
     float: left;
     border: 1px solid black;
     margin-left: 10px;
      <a href="">
        <div>Hello background!  This div is a link.</div>
      <div>this div is not a link</div>


1 Comment

speak up

Add your comment below, or trackback from your own site.

Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*Required Fields