Let’s learn CSS .
1.CSS
stands for Cascading Style Sheets.
2.CSS define how HTML element are to be
displayed.
3.CSS Syntax
4.example
5.Try this code . copy this code ,save as .html and run
<!DOCTYPE
html>
<html>
<head>
<style>
p
{
color: red;
text-align: center;
}
</style>
</head>
<body>
<p>Hello
World!</p>
<p>This
paragraph is styled with CSS.</p>
</body>
</html>
6.result
7.CSS Comment
CSS Comment starts with /* and end with */.
8.CSS selectors.
- Element selector
- the element selector select all the element based on element name.
-
- Id selector
- the id selector uses the id attribute of an HTML element to select a specific element.An id should be unique with a page, so the id selector is used if you want to select a single,unique element.
- try this:-
-
- Class Selector
- The class selector elements with a specific class attribute.To select elements with a specific class,write a period character,followed by the name of class.
- try this:-
- Grouping selector
- You can group the seletors,to minimize the code.
9.Three Ways to Insert CSS.
- External style sheet.
- CSS style sheet must be save with a .css extension.
- each page must include a reference to the external style sheet file inside the <link> element.The <link> element goes inside the head section.
- Internal style sheet.
- An internal style sheet may be used if one single page has a unique style.Internal styles are defined within the <style>` element,inside the head selection of an HTML page .