[thelist] CSS: display: block on links

kasimir-k kasimir.k.lists at gmail.com
Sun Jan 14 09:35:05 CST 2007


> On Sat, Jan 13, 2007 at 05:38:31PM +0000, kasimir-k wrote:
>> Bill Moseley scribeva in 13/01/2007 17:10:
>>> Where this doesn't work so well is when I have text on a second line:
>>>
>>>     <td>
>>>         <a href="stuff">x</a>
>>>         <br />
>>>         Some other text
>>>     </td>


Bill Moseley scribeva in 13/01/2007 19:27:
> Then when display: block is applied to the <a> I get extra white
> space:
> 
>     +----------------------------+
>     | x                          |
>     |                            |
>     | Some other stuff           |
>     +----------------------------+
> 
> When all I'm really trying to do is allow clicking not only on the "x"
> but anywhere to the right of it.

Ok, so if the next sibling is <br /> set its display: none;

for ( var j = 0; j < td.length; j++ ) {
    var link = td[j].getElementsByTagName('a');
    if ( link.length == 1 ) {
       link[0].style.display = 'block';
       if (link[0].nextSibling.nodeName == 'br') {
          link[0].nextSibling.style.display = 'none';
       }
    }
}

.k



More information about the thelist mailing list