tags:

views:

101

answers:

2

Even if I appointed id and a class to an img tag of the html by a rumor and appointed 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;
}

It is a designated way such as the above. I got along well when I tested it in Firefox and IE6. Will there be a problem manners of the CSS?

+2  A: 

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 problem :-)

fesja
thanks a lot!. I think soo ,
ffffff
but, Only img tag my boss says "You Can't apply id or classes to img tag!
ffffff
yes you, check the specs in the W3C document http://www.w3schools.com/tags/tag_IMG.asp
fesja
A: 

However, because the img tag is an in-line level element, You can apply the style of the in-line level, but do not apply the style of the block level. So when you want to let the style of the block level, You must surround the img tag with the tag of some block level.

ffffff
not true. You can set it to "display: block", making it a block element, and thus able to use block css styles like margin, width, etc.
mishac