user6440748
user6440748

Reputation:

text decoration: none. Not working

Hi so i am trying to make a nav menu that links to other pages when clicked. But when i tell it to link somewhere i get this ugly underline and blue text. I dont want that. I have tried "text-decoration: none;" and i have searched a bit about the topic. But it didnt help :/ Thank you for any suggestions!

Here is my html:

<div id="box"> 
    <div id="items">
        <div class="item">Item 1</div>
        <div class="item">Item 2</div>
        <div class="item">Item 3</div>
        <div class="item">Contact</div>
        <div class="item"><a href="#">Donate </a></div>
      </div>
    </div>

    <div id="btn">
      <div id="top"></div>
      <div id="middle"></div>
      <div id="bottom"></div>
    </div>

And this is the CSS

#box {
  position: fixed;
  z-index: 4;
  overflow: auto;
  top: 0px;
  left: -275px;
  width: 275px;
  opacity: 0;
  padding: 20px 0px;
  height: 100%;
  background-color: #f6f6f6;
  color: #343838;
  -webkit-transition: all 350ms cubic-bezier(0.6, 0.05, 0.28, 0.91);
  transition: all 350ms cubic-bezier(0.6, 0.05, 0.28, 0.91);
}

#box.active {
  left: 0px;
  opacity: 1;
}

#items {
  position: relative;
  top: 35%;
  -webkit-transform: translateY(-50%);
  -ms-transform: translateY(-50%);
  transform: translateY(-50%);  
  text-decoration: none;
}

#items .item {
  position: relative;
  cursor: pointer;
  font-size: 23px; 
  padding: 15px 30px;
  -webkit-transition: all 250ms;
  transition: all 250ms;
}

#items .item:hover {
  padding: 15px 45px;
  background-color: rgba(52, 56, 56, 0.2);
}

#btn {
  position: fixed;
  z-index: 5;
  top: 15px;
  left: 15px;
  cursor: pointer;
  -webkit-transition: left 500ms cubic-bezier(0.6, 0.05, 0.28, 0.91);
  transition: left 500ms cubic-bezier(0.6, 0.05, 0.28, 0.91);
}

#btn div {
  width: 35px;
  height: 2px;
  margin-bottom: 8px;
  background-color:   #F5F5F5;
  -webkit-transition: -webkit-transform 500ms cubic-bezier(0.6, 0.05, 0.28, 0.91), opacity 500ms, box-shadow 250ms, background-color 500ms;
  transition: transform 500ms cubic-bezier(0.6, 0.05, 0.28, 0.91), opacity 500ms, box-shadow 250ms, background-color 500ms;
}

#btn:hover > div { box-shadow: 0 0 1px  #F5F5F5; }

#btn.active { left: 230px; }

#btn.active div { background-color: #343838; }

#btn.active:hover > div { box-shadow: 0 0 1px #343838; }

#btn.active #top {
  -webkit-transform: translateY(10px) rotate(-135deg);
  -ms-transform: translateY(10px) rotate(-135deg);
  transform: translateY(10px) rotate(-135deg);
}

#btn.active #middle {
  -webkit-transform: scale(0);
  -ms-transform: scale(0);
  transform: scale(0);
}

#btn.active #bottom {
  -webkit-transform: translateY(-10px) rotate(-45deg);
  -ms-transform: translateY(-10px) rotate(-45deg);
  transform: translateY(-10px) rotate(-45deg);
}

Upvotes: 0

Views: 2094

Answers (2)

George
George

Reputation: 36784

You've already put your finger on it. The (default) underline is applied to the link, not #items. Those are the elements you will need to re-style:

#items .item a{
    text-decoration: none;
    color: inherit;
}

Upvotes: 3

Lalji Tadhani
Lalji Tadhani

Reputation: 14149

add to a tag text-decoration

.items  a{
  text-decoration: none;
  color:#000;
}

Upvotes: 0

Related Questions