class attribute
Sets the style class or classes that belong to the element.
With this attribute you can assign Cascading Style Sheets (CSS) declarations to an element.
CSS is useful for adding styling behaviors to an element.
For a complete list of style properties, please see the page for CSS properties.
JavaScript page for this attribute: className. You can find other example(s) there. |
Possible values:
String that sets a space-separated list of the related class names.
Default: this attribute has no default value.
Example HTML code 1:
This example illustrates the use of the class attribute:
|
||||
<head> <style> .text {color: red;} </style> </head> <body> <p class="text" id="myP"> This text is red. </p> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by tags:
a, abbr, acronym, address, applet, area, b, baseFont, bdo, big, blink, blockQuote, body, br, button, caption, center, cite, code, col, colGroup, dd, del, dfn, dir, div, dl, dt, em, embed, fieldSet, font, form, frame, frameSet, H1, H2, H3, H4, H5, H6, head, hr, html, i, iframe, img, input:button, input:checkbox, input:file, input:hidden, input:image, input:password, input:radio, input:range, input:reset, input:search, input:submit, input:text, ins, isIndex, kbd, keygen, label, legend, li, link, listing, map, marquee, menu, nobr, noFrames, noScript, object, ol, optGroup, option, p, plainText, pre, q, rt, ruby, s, samp, select, small, span, strike, strong, sub, sup, table, tBody, td, textArea, tFoot, th, tHead, tr, tt, u, ul, var, xmp
External links:
User Contributed Comments