CSS:
CSS or cascading style sheet is a style sheet language used to desribe the look and formatting of a document written in HTML and XML
CSS describe how element should describe on website
Basic syntax of CSS
selector like we have to apply CSS on paragraph than
p {font-size: 20px;}
There are three types of CSS
Inline CSS
Internal CSS
External CSS
Inline CSS :-
Inline CSS practice of including css directly within the html document rather than a seprate sheet this is archieved by using style attribute within html tag like syntax "
p style = "color:red; background color:red;
Internal CSS :-
internal CSS refers to the practice of including CSS directly within a HTML document rather than a separate file its placed inside the style element syntax like:-
< style >
h1(
color: red;
)
< /style >
External CSS :-
external CSS refer that are stored in separate files and linked to HTML document CSS is a
stylesheet language to describe there presentation of a document written in HTML or XML
its making code more modular and easier to maintain
Here are the some basic step to use external CSS
Create a CSS file
Write CSS rules
Link CSS to HTML
Selector in CSS:
Universal Selector
Element selector
ID & Class selector
Group selector
Descendant selector
Universal selector
universal selector is denoted by an asterisk(*). it is a special selector that matches any element when used in a CSS file when used in CSS rule,
the universal selector applies style to every element on a webpagestructure like *{ margin:0; padding:0; box-sizing:border-box; }
Element selector
target html element based on their tag name .it is one of the most straight forward and commonly used selectors in CSS.
to apply style to a HTML element use element selector followed by element's tag namep{ style must be there; }
ID selector
way to select and style a specific HTML element based on its unique identifier .the id selector is denoted by the hash (#) followed by id value
structure like #myElement{ color:blue; font-size:16px; }
Class selector
class selector used to select elements based on their class attributes . their classs attributes allow you to apply styles to multipe html element using a single class name.
period(.) followed by class name itselfsyntax is like .myclass{ color:red; font-size:10px; }
Group selector
not a standard term or selector refer to combination of selectors to target specific groups of elements in your HTML document
structure like h1,h2,h3,p{ color: blue; background-color: red; }