Strict HTML image border using CSS

I have the following to display a clickable image (no frame) on the website:

<a href="link"><img src="img" border="0" /></a>

However, this is not strict XHTML 1.0, so I changed it too:

<img src="img" class="mystyle" />

And CSS:

mystyle img
{
    border: 0px;
}

However, this only works in Safari and Chrome and does not work in IE and FireFox.

I understand that w3 validators are not needed, but it was interesting if anyone met this and possibly fix it :)

EDIT: The style was a typo, I meant the class;)

thank

+3
source share
5 answers

() , , , , - , @Adriano )

Html

<img src="img" class="mystyle" />

style , css. class.

CSS

.mystyle
{
    border: 0px;
}

. (# ). img, , img, , mystyle.

+6

css ".". . css, :

.mystyle img {   border: 0px; }

html "class", "style". , Css, :

<img href="img" style="border: none;" />
+2

-, class="mystyle" style="mystyle".

-, <img > - , mystyle, CSS .

CSS, , mystyle, img.

img.mystyle.

, CSS :

img.mystyle {
    border:0px;
}

HTML :

<img src="img" class="mystyle" />

, , , mystyle; img , . , , .

, Chrome/Safari, Firefox/IE: , Chrome/Safari . , , , , Firefox IE - , , .

+2
source

Shouldn't be <img src="img" class="mystyle" />?

0
source

My problem is that you will not catch css properly. it should be**.**mystyle img

<a href="link" ><img style="border: 0px" src="http://www.google.com/images/nav_logo16.png"  /></a>
0
source

Source: https://habr.com/ru/post/1772669/


All Articles