Writing CSS Rules
In writing the existing CSS rules are used, in CSS there are major components in the writing selector and Declarator.
Consider the basic example of writing CSS below:
Announcer of the selector {};
The selector is of writing HTML tags such as H1, H2, p, b, etc.
Announcer is that instructs the browser to create a view selector in accordance with that of the declaratory orders.
While declarator consists of Property and Value
A small example:
Usually the writing of articles are widely used Tag
or paragraph, if you
want to change the font of the writing of your article in a paragraph, the CSS
writing is as follows:
p {font-family: verdana};
Is the selector of the paragraph and that are in braces is declarator that instructs the browser to display the paragraph article with bold font.
While font-family is a Property and Verdana are Value
Details are as the following formula:
Selektor{Property:Value};
The above formula is the key to mastering CSS, and keeps you remember that CSS is actually very simple and simple.
Coach ID day Coach Class
Besides selector that can be written directly by removing <...> such
you simply write p course, there are other selectors that are not less important ID and selector Class selector.
Try to imagine if you want to change the look of the tag
and zoom different such fonts, you can specify the
tag in the CSS but if the writing p {font-family: arial} then all the
will be converted into a font Arial all.
What if one of the tag
you want it converted into Verdana font, for that you need ID or Class Selector.
ID selector
The function of the selector Id is to give a sign to the HTML tag that has been given ID could be given another format.
For example:
writing in HTML tags
here you write articles
Writing your other articles
Here you give Selector ID with name toc, and the CSS you can give this code as follows:
P (font-family:verdana}
#toc{ font-family:arial}
At the writing of ID selectors ID marked using the '# Which means the article on p that has been given ID will be readable font to arial while while p others read using Verdana font.
Class selectors
For the same function with the selectors Class selectors but the selectors Class ID you can give more than one class selector but the selectors ID you can not give the name of the same ID.
For the same function with the selectors Class selectors but the selectors Class ID you can give more than one class selector but the selectors ID you can not give the name of the same ID.
Class Selector Example:
In the HTML Tag
Your article here
In the CSS:
.media {font-family:calibri}
In writing Class Class selectors are marked using the '. '
The conclusion is:
In both selectors have the same function, but the difference is in the selectors ID you can not make more than one other words selector is used for a specific ID.
While the class selector you can put HTML Tag Selector Class on more than one, but all of it will depend going to need you.
Next, you can learn: How to Combine HTML with CSS.