Make Money Online!
Hi, I'm Ben and I own Create a Great Website! I'm currently earning well over $1,500 plus per month online in my spare time, and I want to show you how you can do the same.
Fill out the form below and I'll send you my free guide to create a great website and how you can earn money online just like I do! You won't be disappointed.
Make Money Online!
CSS Tutorials :
CSS id and class Selectors
CSS is great for applying a style to an existing HTML element such as a heading or paragraph tag, but its real power comes into play when it allows you to specify your own selectors called "id" and "class" selectors.
The id Selector
The id selector is used to specify a style for a single, unique, element. It can be applied to any element on a web page.
The id selector uses the id attribute of the HTML element, and begins with a hash symbol "#".
declaration block
}
In its simplest format, the id selector looks like the example below. Here the id selector is called "navigation" and is indicated by the # sign at the beginning of the rule. The id selector is followed by the opening curly bracket "{" then the declarations for the id selector are followed by the closing curly bracket "}".
Example
declarations
}
In the style rule below, the id selector is applied to the element with the id="para1". It is followed by the property (text-align) and the value for the property (center). In this id selector, it also includes a second property (color) followed by the property (#DD7878) which defines the color.
Example
{
text-align: center;
color: #DD7878;
}
Note: You cannot begin an ID name with a number. It won't work in some browsers.
The class Selector
The class selector is used to define a style for a group of elements. The class selector is most often used on several elements.
This allows you to set a particular style for HTML elements with the same class.
The class selector used the HTML class attribute, and is defined with a "."
In the example below, all HTML elements with class="left" will be left-aligned:
Example
You can also specify that only specific HTML elements should be affected by a class.
In the example below, all p elements with class="center" will be center-aligned:
Example
Share this Webpage
This site proudly build with Site Build It!





