Select Language:

class

about class :
  • class attribute specifies a classname for an element.
  • class attribute is mostly used to point to a class in a style sheet. However, it can also be used by a JavaScript (via the HTML DOM) to make changes to HTML elements with a specified class.
  • class attribute cannot be used in the following HTML elements: base, head, html, meta, param, script, style, and title.
  • class attribute possible to assign multiple classes to one HTML element, like : <span class="left_menu important">. This allows you to combine several CSS classes for one HTML element.
  • class attribute value is begin with a number, like : <span class="10points_list">.

class usage :

<"element" class="value">
class value :
  1. classname: Specifies the name of a class for an element. To specify multiple classes for one element, separate the classnames with a space

class example:

<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>
<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important"> .... </p>
</body>
</html>



origin by : w3schools.com

0 comments: