CSS_Stylesheet_Formatted
CSS_Stylesheet_Formatted
Inline style sheet: It is a style to single element to use inline styles used to apply unique
add style attribute to relevant element - The style attribute contains any css property.
An internal style sheet may be used if one single HTML page has a unique style. It is
defined inside the <style> element inside the head section.
By using an external sheet you can change the look of an entire website by changing just
one file.
Each HTML Page must include a reference to an external style sheet file inside the
<link> element, inside head section.
CSS syntax:
Selectors:
1. Element selector: This selector selects HTML elements directly based on element
name.
Syntax:
element {
/* css properties */
Syntax:
#elementID {
/* css properties */
Syntax:
element1, element2 {
/* css properties */
4. Class selector: This selector selects HTML elements using class attribute.
Syntax:
.class {
/* css properties */
5. Universal selector: This selector selects all the HTML elements in a page.
Syntax:
*{
/* css properties */
Color Properties:
Attribute:
Border Properties:
Attributes:
Background Properties:
Attributes:
Padding Properties:
margin-top: Gives space between element and its top side surrounding content.
margin-bottom: Gives space between element and its bottom side surrounding content.
margin-right: Gives space between element and its right side surrounding content.
margin-left: Gives space between element and its left side surrounding content.
margin: It gives space between elements and all its surrounding content.
Position Property: