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

Text Link applying decoration within a flex

I have a button set up like this:

<a href="*LINK*"><button type="submit" class="output loadclass"><img class="btnicon loadclass" src="/assets/thumb.png"><span class="btntext">YouTube</span></button></a>

After applying styles, it looks something like
this.

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

However, when I apply display: flex to the button it functions as intended, but it shows the underline on the text.

I’ve tried setting text-decoration to none but it’s still showing up, any idea why?

>Solution :

It seems like something got mixed up in your style. Actually, it should work quite easily and flex definitely has no effect on the anchor style within a flex container. Example below:

.flex {
  display: flex;  
  align-items: center;
  border: 1px solid #000;
  border-radius:20px;
  width: 300px;
  margin:auto;
  gap:10px;
}

.flex a {
  text-decoration: none;
}
.flex img {
  border-radius:20px 0px 0px 20px;
}
<div>
  <div class="flex">
    <img src="https://via.placeholder.com/200">
    <a href="">link</a>
  </div>
</div>
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