Even if the img tag assigns an id and a class, it is ineffective. Is it true?

Even though I assigned id and class to img html tag by hearsay and assigned it in css, it came when it was ineffective.

img id="hogehoge_id" class="fugafuga_class" src="example.gif" /
#hogehoge_id{
  float:left;
}
.fugafuga_class{
  padding: 10px;
}

      

This is the designated way like above. I got along well when I tested it in Firefox and IE6. Will there be problems with CSS?

0


a source to share


2 answers


if you ask if you can apply css properties to id and classes of the same tag at the same time, the answer is yes. No problems: -)



+2


a source


However, as the img tag is the element level in a row , you can apply a style line level, but do not use a block-level style. Therefore, when you want to allow block level style, you must surround the img tag with some block level tag.



0


a source







All Articles