Which HTML tags can use the class attribute?
(In which standards — e.g. HTML/XHTML/HTML5 etc. — and in which browsers.)
For example, is the following legal or not?
<i class="myclass">text inside</i>
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In HTML 4, the
classattribute can be used in all elements except butBASE,BASEFONT,HEAD,HTML,META,PARAM,SCRIPT,STYLE, andTITLE(see index of attributes in the HTML 4.01 specification). And since XHTML 1.0 is (briefly) just HTML 4 with XML syntax, this does also apply to XHTML 1.0.