Quantcast
Viewing latest article 4
Browse Latest Browse All 34

Re: hyperlinks within css

If you aren't using an html5 doctype and have something like...

 

<div id="box"><a href="page.html">Your link here</a></div>

 

But you want the link on the entire container, you could use css to turn an <a> tag into a block  element so it acts like a <div> and then style accordingly...

 

<a id="box" href="page.html">Your link here</a> <!-- remove the <div> wrapping the <a> -->

 

The css could be something like...

 

a#box {

     display:block;

     height:20px;

     width:100px;

     font-size:10px;

     line-height:20px;

     text-decoration:none;

     text-align:center;

     color:white;

     background-color:blue;

     border:1px solid black;

}

 

This will create a little blue box with rounded edges surrounded by a 1 pixel black border with white text centered both horizontally and vertically. The entire box will act as the link.


Viewing latest article 4
Browse Latest Browse All 34

Trending Articles