Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can i get rid of the line under the text of a button

I have this one button which has some sort of line under it.


it’s small and blue but it annoys me.

#p {
  position: relative;
  top: 10px;
  display: block;
  margin-left: auto;
  margin-right: auto;
  height: 100px;
  width: 55%;
  font-size: 30px;
  font-family: 'Bitter', serif;
  color: #588b42;
  border: none;
  background-color: #1a1a19;
}

#p:hover,
#p:visited,
#p:link,
#p:active {
  text-decoration: none;
}
<a href="portfolio.html" target="_blank"><button id="p">Portfolio</button></a>

I tried to set text-decoration to none, both in the normal style for the button and in every single pseudo-class, but it has not done anything

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

This is what i’ve tried:

#p{text-decoration: none;}

#p:hover, #p:visited, #p:link, #p:active {text-decoration: none;}

>Solution :

The line comes from the anchor, not the button, and all your selectors are targeting the button with the ID of p. So you need a{text-decoration: none;}.

But note that a button in an anchor is invalid HTML

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading