JavaFox
JavaFox

Reputation: 63

How can I make my li that contains an a clickable?

So I'm trying to figure out a way to make the tabs in my navigation bar clickable as well as the link text. Adding padding: 20px 30px; makes the second to last tab shift up and the text shift to the right. I'm willing to do some major alterations so please any answer is a good one.Here's my HTML.

<div id="tab_container">
  <nav id="tabs">
    <ul id="nav">
      <li class="active"><a href="#">About</a></li>
      <li class="inactive"><a href="#">Services</a></li>
      <li class="inactive"><a href="#">Our Staff</a></li>
      <li class="inactive"><a href="#">book</a></li>
      <li class="inactive"><a href="#">Gift Cards</a></li>
      <li class="inactive"><a href="#">Reviews</a></li>
    </ul>
  </nav>
</div>

Heres the CSS...

#tab_container
{
    background-color: #222;
    display: -webkit-box;
    -webkit-box-flex: 1;
    display: block;
    position: relative;
        max-width: 970px;
    width: 100%;
    text-align: center;
}

#tabs 
{
    float: left;
    margin-top: 0px;
    width: 100%;
    max-width: 970px;
    background-color: #222;
    padding-top: 20px;
    text-align: center;
}

#nav 
{
    width: 100%;
    max-width: 970px;
    text-align: center;
}

ul
{
    float: left;
    max-width: 970px;
    display: -webkit-box;
    -webkit-box-flex: 1;
    width: 100%;
    padding-left: 0px;
    margin-bottom: 0px;
    margin-top: 0px;
    margin-right: 0px;
    text-align: center;

}

ul li
{
    display: inline-block;
    text-align: center;
    width: 158px;
    height: 70px;
    background-color: black;
    font-size: 18px;
    text-transform: uppercase;
    text-align: center;
    margin:0 auto;
    padding: 0;
}

ul li a
{
    color: #54544b;
    text-decoration: none;
    text-align: center;
    margin: 0px auto;
    line-height: 70px;
    padding: 20px 30px;

}

a:hover
{ 
    color: #CF7BA1;
}

.active a
{
    text-decoration: underline;
    color: #CF7BA1;

}

Upvotes: 0

Views: 130

Answers (1)

G-Cyrillus
G-Cyrillus

Reputation: 105863

set display-blocks to A:

ul li a {
  display:block;
  height:100%;
  width:100%;
  line-height:XXpx;
}

Upvotes: 3

Related Questions