1

How can I remove CSS of link (a) on any linked image?

There is a effects for links (textual links), but it is also on images. So, what I need to add.

I tryed adding this

a img {
    text-decoration: none;
    border: 0 none;
}

but it not works...

Here is a code:

<!DOCTYPE html>
<html>
<head>
<style>


a {
 outline: none;
 text-decoration: none;
 position: relative;
 color: #9e9ba4;
 display: inline-block;
}
/* Kukuri */
a {
 text-transform: uppercase;
 font-weight: 300;
 overflow: hidden;
 
}

a:hover {
 color: #c5c2b8;
}

a::after {
 content: '';
 position: absolute;
 height: 16px;
 width: 100%;
 top: 50%;
 margin-top: -8px;
 right: 0;
 background: #ddd;
 -webkit-transform: translate3d(-100%,0,0);
 transform: translate3d(-100%,0,0);
 -webkit-transition: -webkit-transform 0.3s;
 transition: transform 0.3s;
 -webkit-transition-timing-function: cubic-bezier(0.7,0,0.3,1);
 transition-timing-function: cubic-bezier(0.7,0,0.3,1);
}

a:hover::after {
 -webkit-transform: translate3d(100%,0,0);
 transform: translate3d(100%,0,0);
}

a::before {
 content: attr(data-letters);
 position: absolute;
 z-index: 2;
 overflow: hidden;
 color: #424242;
 white-space: nowrap;
 width: 0%;
 -webkit-transition: width 0.4s 0.3s;
 transition: width 0.4s 0.3s;
}

a:hover::before {
 width: 100%;
}


</style>
</head>
<body>

<a href="#" ><p>Some link</p></a>

<p>Some text <a href="#" ><img src="image.jpg" alt="Image" width="42" height="42"></a> some text.</p>


</body>
</html>
lmgonzalves
  • 6,518
  • 3
  • 22
  • 41
Zdravkec Žac
  • 13
  • 1
  • 4
  • Please check this SO thread... http://stackoverflow.com/questions/814366/how-can-i-remove-the-outline-around-hyperlinks-images – bbh Jun 01 '15 at 19:35

3 Answers3

1

You can do this using the following CSS

pointer-events: none;
cursor: default;

You may need to add a class to your link e.g.

<a href="#" class="disable">example</a>
0

Try adding class="<whateverNameYouWant>" to your <a> and then use .<whateverNameYouWant> instead of a img in your css. (changing <whateverNameYouWant> with an actual name of course)

NendoTaka
  • 1,224
  • 8
  • 14
0

Just need to add cursor:default; in a css

<!DOCTYPE html>
<html>
<head>
<style>


a {
 outline: none;
 text-decoration: none;
 position: relative;
 color: #9e9ba4;
 display: inline-block;
    cursor:default; // ---- here ---- //
}
/* Kukuri */
a {
 text-transform: uppercase;
 font-weight: 300;
 overflow: hidden;
 
}

a:hover {
 color: #c5c2b8;
}

a::after {
 content: '';
 position: absolute;
 height: 16px;
 width: 100%;
 top: 50%;
 margin-top: -8px;
 right: 0;
 background: #ddd;
 -webkit-transform: translate3d(-100%,0,0);
 transform: translate3d(-100%,0,0);
 -webkit-transition: -webkit-transform 0.3s;
 transition: transform 0.3s;
 -webkit-transition-timing-function: cubic-bezier(0.7,0,0.3,1);
 transition-timing-function: cubic-bezier(0.7,0,0.3,1);
}

a:hover::after {
 -webkit-transform: translate3d(100%,0,0);
 transform: translate3d(100%,0,0);
}

a::before {
 content: attr(data-letters);
 position: absolute;
 z-index: 2;
 overflow: hidden;
 color: #424242;
 white-space: nowrap;
 width: 0%;
 -webkit-transition: width 0.4s 0.3s;
 transition: width 0.4s 0.3s;
}

a:hover::before {
 width: 100%;
}


</style>
</head>
<body>

<a href="#" ><p>Some link</p></a>

<p>Some text <a href="#" ><img src="image.jpg" alt="Image" width="42" height="42"></a> some text.</p>


</body>
</html>
Ravi Makwana
  • 2,782
  • 1
  • 29
  • 41