id
The id selector is used to specify a style for a unique element, the id selector is defined with a #.
#paragraphYou can't start an id name with a number, it won't work in Firefox.
{
text-align:left;
color:yellow;
}
class
The class selector is used to specify the style for a group of elements. The class selector is commonly used on multiple elements, This lets you set a style for many HTML elements with the same class. The class selector is defined with a '.'
In this example, all HTML elements with class="center" will be center-aligned:
.center {text-align:center;}As with id, don't start a class with a number, this is only supported in Internet Explorer.
Helpful as always, thanks.
ReplyDeletevery integral to CSS! class is super useful
ReplyDelete