CSS:
CSS - Cascading style sheet, HTML defines the structure and content of the web content, where CSS is web content that allows you to change the appearance of the HTML.
CSS allows changing the size and style font, decorating the border, background images, etc. It is also used to position the elements on the page.
Syntax:
selector{
property : value;
}
The selector is the target element in the HTML. The property is the predefined terms within the CSS that all web browser understands, the property is followed by a colon and the value. The value is the particular style/ variable assigned to the property.
Example:
p {
font-size: 18px;
font-family: sans-serif;
color: blue
}
Here the p is the target element in the HTML. If we have used "n" times p tag in HTML, the above-mentioned style is applied to all the p elements, so all the p elements have the font size of 18px, font family of Sans sarif and the font color is blue.
If we want to work on a specific style on "n" times used HTML tags, we can use class names and id names used as a selector. To use the class name as a selector (.) dot is prefixed before the class name and (#) hash is prefixed before the id name to use the id as a selector.
<p class= "para"> This is pragraph</p>
.para {
font-size: 18px;
font-family: sans-serif;
color: blue
}
In the above example, the class name is used as a selector.
<p id="para"> This is pragraph</p>
#para {
font-size: 18px;
font-family: sans-serif;
color: blue
}
In the above example, the id name is used as a selector.
The difference between the class and the id is, the class name can be used on a group of specified elements while the id name can be used on only one specific element.
Thank you!!!
Have a good day!!!!
No comments:
Post a Comment