Discussion:
Use of display:block to make larger link area clickable
(too old to reply)
Mary
2010-04-08 10:42:15 UTC
Permalink
I am following a Lynda video about making a grid using CSS which has
worked great except that I want the photos as well as the text to be
clickable and this isn't working. The video says add this:
li a {
display: block;
text-align: center;
}

But my links are still confined to the text itself. Any suggestions
more than welcome.
Thank you.
Eric Wilson
2010-04-08 18:52:15 UTC
Permalink
Post by Mary
I am following a Lynda video about making a grid using CSS which has
worked great except that I want the photos as well as the text to be
li a {
        display: block;
        text-align: center;
}
But my links are still confined to the text itself. Any suggestions
more than welcome.
Thank you.
You might want to post some code, my first guess would be that the
anchor tag that is not behaving like a block is not nested within an
<li> tag.
Mary
2010-04-09 09:28:24 UTC
Permalink
Post by Eric Wilson
Post by Mary
I am following a Lynda video about making a grid using CSS which has
worked great except that I want the photos as well as the text to be
li a {
        display: block;
        text-align: center;
}
But my links are still confined to the text itself. Any suggestions
more than welcome.
Thank you.
You might want to post some code, my first guess would be that the
anchor tag that is not behaving like a block is not nested within an
<li> tag.
Thanks for that but as far as I can see it's not that.

<li id="six"><a href "#">Bathroom</a></li>

I've followed the Lynda video very carefully and my code seems to be
identical to theirs ... but of course there must be something. Should
I post more code than this?

Here's a bigger chunk of the css:
li#six {
background-repeat: no-repeat;
background-position: 50% 10px;
padding-top: 130px;
background-image: url(../images/flat1/thumbf1bath.jpg);
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #333;
}
a {
display: block;
text-align: center;
}
a:link {
color: #894a4f;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #894a4f;
font-weight: bold;
}

Thanks for looking.

Loading...