I want to remove a link style from an img in it

remove underline link image
remove blue border around image link
wordpress remove underline from links
remove underline from link html
html email remove link underline outlook
remove border from image link css
remove underline from link css
remove underline from link gmail

I'm working on a project where the client can create his own content, so he added an image (<img>) in a link (<a>) that I styled.

I'm trying not to use style in this image, but it's not working because the img is inside the <a> tag, so it is inheriting the style from a. Maybe you know another way to do it with SASS?

  • I tried to unstyle the img that's inside a but without success.
  • I also tried this: Removing dotted underline from linked img

Here's a codepen: https://codepen.io/Gabrielsen/pen/rNNaEvb

And a snippet:

a {
  font-family: sans-serif;
  color: black;
  font-size: 2rem;
  text-decoration: none;
  transition: 0.5s;
  border-bottom-width: 0.2rem;
  border-bottom: solid .2rem green;
}

a img {
  width: auto;
  height: 5rem;
}

a:hover,
a:focus,
a:active {
  box-shadow: inset 0 -0.5rem 0 green;
  border-color: green;
}

// I want remove the style of the a from the img but I can't do this because her parent is the link and he have the style : 
a img,
a:hover img,
a:focus img,
a:active img {
  border-bottom-width: 0;
  box-shadow: none;
}
<a href="#">
  <img src="https://cdn.vox-cdn.com/thumbor/heXu37IbDvVy6Qbo1wbPjNvi6Ys=/0x0:712x423/1200x800/filters:focal(385x120:497x232)/cdn.vox-cdn.com/uploads/chorus_image/image/55531035/Screen_Shot_2017_06_30_at_3.17.00_PM.0.png" alt="Juste... Pickle-rick"> My
  link from the hell
</a>

I will recommend you to go for the image width instead of the height and set height: auto; then use the calc function

a {
  font-family: sans-serif;
  color: black;
  font-size: 2rem;
  text-decoration: none;
  position: relative;
}
a:after{
  content: "";
  position:absolute;
  bottom: 0;
  right:0px;
  height: 1rem;
  width: calc(100% - 5rem);/* 100% - (width of the image)*/
  transition: 0.5s;
  border-bottom-width: 0.2rem;
  border-bottom: solid .2rem green;
}
a img {
  height: auto;
  width: 5rem;
}

a:hover:after,
a:focus:after,
a:active:after {
  box-shadow: inset 0 -0.5rem 0 green;
  border-color: green;
}

a img,
a:hover img,
a:focus img,
a:active img {
  border-bottom-width: 0;
  box-shadow: none;
}
<a href="#">
  <img src="https://cdn.vox-cdn.com/thumbor/heXu37IbDvVy6Qbo1wbPjNvi6Ys=/0x0:712x423/1200x800/filters:focal(385x120:497x232)/cdn.vox-cdn.com/uploads/chorus_image/image/55531035/Screen_Shot_2017_06_30_at_3.17.00_PM.0.png" alt="Juste... Pickle-rick"> My
  link from the hell
</a>

Removing underlining from image link, I have a page with a single large image that also has a link element, and I'd like to remove the underlining from the image link. I am working in  The only possible reason I can see for a disabled link style is to show the link is now broken… In that case you’d still want it to look like a link (just with a slight change to indicate it’s broken) and doesn’t really matter if the user can click it.


Add a class to your anchor link like so:

<a class="myLink" href="#">
  <img src="https://cdn.vox-cdn.com/thumbor/heXu37IbDvVy6Qbo1wbPjNvi6Ys=/0x0:712x423/1200x800/filters:focal(385x120:497x232)/cdn.vox-cdn.com/uploads/chorus_image/image/55531035/Screen_Shot_2017_06_30_at_3.17.00_PM.0.png" alt="Juste... Pickle-rick"> My
  link from the hell
</a>

Then target that link with this CSS:

.myLink {
border:none;
}

Remove style only for linked images - HTML & CSS, Hi on my site http://bit.ly/dfcU0O I have set dotted underlines for links, I want to make linked images in the content have no dotted underline though, how can I do​  For example, one can use an image as a clicking button for a particular link. However, as a default the browser displays a border around this image. To remove the border or an image in HTML /CSS, 0one needs to change the required attributes. In this case, to remove the border, the user has to set the attribute of the border as zero.


You cant make it unless image is positioned absolute or other way can add margin-bottom:-0.5rem; to image which hides border

remove link underline from image only if the anchor tag contains an , border-bottom-style: dotted; by styling the text links I am also styling image links​, I want any image in a link .contains-image { border: none; }. If you don't want to see the underline and default color which is provided by the browser, you can keep the following code in the top of your main.css file.


Want To Create Images As Links With Or Without Borders? Here's , Inline Styles. The first way to apply these styles to the image is to use the same inline styling method previously used to remove the  As @Torkil-Johnsen mentioned in a comment below, you might want to give a different style to make it more obvious, but to just remove it is very bad for accessibility (e.g. people who only use a keyboard or other assistive device to tab through elements). – Frank Forte Nov 7 '19 at 19:53


How to remove underlines from links, Here's where you will need to add a bit of HTML code to force the link to not underline. First, you'll add a style attribute inside the a tag, like this <a  In addition, links can be styled differently depending on what state they are in. The four links states are: a:link - a normal, unvisited link; a:visited - a link the user has visited; a:hover - a link when the user mouses over it; a:active - a link the moment it is clicked


How to remove blue border around hyperlink images : Symprex , To remove the blue border around hyperlink images: Set border attribute to 0 on the img tag. Set border inline style to 0 on the img tag. If necessary, in the image's style-code, you may also want to give the image itself a margin-bottom: 5px; or something of the sort to push the caption down a wee bit and not have it so snug against the image's bottom. Are you trying to put a photo credit under an image, and you need the caption to include a clickable link?