J.Brooker J.Brooker - 5 months ago 19
HTML Question

HTML class not linking to internal CSS

<html>
<head>
<style>
img.cardoption {width=20px;}
</style>
</head>
<body>
<img class='cardoption' src='http://s32.postimg.org/9vao2t9kl/scc_std.png'/>
</body>
</html>


In this simple piece of HTML, and accompanying CSS, I have an image with class name 'cardoption'. In the style tag in the head, I have attempted to set the width of this image to 20px.

However, for some reason the image is not resizing. Can someone please explain why?

Answer

Use

img.cardoption {width:20px;}

Remove =

Comments