Search code examples
cssblock

Display:block not working


I am trying to set up navigation links (using a list) that are entirely clickable. However, right now only the text and images are clickable. Display block doesn't seem to be working.

Here is the final result: http://rec.wordpress.uconn.edu

#program-buttons {
display:block;
width:100%;
height:65px;
background-color:#cccccc;   
}
.program-button {
display:block;
float: left;
font-size: 14px;
height: 45px;
line-height: 17px;
list-style-type: none;
margin:0;
padding: 10px;
width: 208px;
vertical-align:middle;
border-left: solid 1px #ffffff;
border-right: solid 1px #8C8C8C;
transition: background 0.4s ease;
-webkit-transition: background 0.4s ease;
-o-transition: background 0.4s ease;
-moz-transition: background 0.4s ease;
 }
.program-button:hover {
background-color:#202631;
}

#program-buttons .program-button a {
display:block;
color:#fff;
font-weight:bold;
}
#program-butt ons .program-button a:hover {
text-decoration:none;
}

#program-buttons img {
background-clip: border-box;
background-color: rgba(0, 0, 0, 0);
background-image: none;
background-origin: padding-box;
border-bottom-color: rgb(255, 255, 255);
border-bottom-style: solid;
border-bottom-width: 1px;
border-left-color: rgb(255, 255, 255);
border-left-style: solid;
border-left-width: 1px;
border-right-color: rgb(255, 255, 255);
border-right-style: solid;
border-right-width: 1px;
border-top-color: rgb(255, 255, 255);
border-top-style: solid;
border-top-width: 1px;
box-shadow: rgba(0, 0, 0, 0.199219) 1px 2px 2px 0px;
color: rgb(46, 44, 42);
cursor: auto;
display: block;
float: left;
height: 45px;
list-style-type: none;
margin-right: 10px;
margin-top: 0px;
text-align: -webkit-auto;
text-decoration: none;
text-shadow: 
rgba(255, 255, 255, 0.296875) 0px 1px 0px;
width: 60px;
}

<ul id="program-buttons" class="clearfix">
   <li class="program-button"><a href="#"><img src="http://www.recsports.ufl.edu/images/uploads/KanJam_thumbnail_1.jpg" width="60" height="45" alt="Title"> <span>Intramural<br> Sports</span></a></li>
   <li class="program-button"><a href="#"><img src="/images/uploads/KanJam_thumbnail_1.jpg" width="60" height="45" alt="Title"> <span>BodyWise</span></a></li>
   <li class="program-button"><a href="#"><img src="/images/uploads/KanJam_thumbnail_1.jpg" width="60" height="45" alt="Title"> <span>UConn<br> Outdoors</span></a></li>
   <li class="program-button"><a href="#"><img src="/images/uploads/KanJam_thumbnail_1.jpg" width="60" height="45" alt="Title"> <span>Drop-In<br> Rec</span></a></li>
</ul>

Solution

  • The issue is that your li tags have 10px padding. Move that padding to the a tags instead.

    Edit: And remove the fixed heights.