CSS_PROPERTIES (1)
CSS_PROPERTIES (1)
Session 2021-2022
CSS PROPERTIES
1. Background colour
The background-color property sets the background color of an element.
Eg:
background-color: coral;
background-color: #92a8d1;
background-color: rgb(201, 76, 76);
2. Color
The color property specifies the color of text.
Eg:
body {
color: red;
}
h1 {
color: #00ff00;
}
3. Alignment
The text-align property specifies the horizontal alignment of text in an element
Eg:
h1 {
text-align: center;
}
p{
text-align: right;
}
p{
text-align: justify;
}
4. Font
Eg:
Eg:
border-style: dotted;
border-style: dashed;
border-style: solid;
border-style: double;
border-width: 5px;
border-width: medium;
border-width: thick;
border-color: red;
border-color: #ff0000;
border-radius: 5px;
border-collapse: separate;//default value
border-collapse: collapse;
6. Margin
The margin property sets the margins for an element, and is a shorthand property for the
following properties:
margin-top
margin-right
margin-bottom
margin-left
Eg:
margin-bottom: 25px;
margin-left: 30px;
margin-right: 150px;
margin-top: 25px;
margin: auto; // The browser calculates a margin
7. Padding
An element's padding is the space between its content and its border.
padding-top
padding-right
padding-bottom
padding-left
Eg:
padding-bottom: 25px;
padding-right: 25px;
padding-left: 25px;
padding-top: 25px;
8. Width
The width property sets the width of an element.
Eg:
width: 50%;
width: 250px;
width: auto;// The browser calculates the width
9. Height
The height property sets the height of an element.
Eg:
height : 50%;
height : 250px;
10. Visibility
The visibility property specifies whether or not an element is visible.
Eg:
visibility : visible;//default value
visibility : hidden;
11. class
The class attribute is often used to point to a class name in a style sheet.