Backgrounds style in CSS
- As the name suggests backgrounds are used to add background to the HTML elements.
- Using CSS backgrounds we can add background images, and background colors to the HTML elements
- In today's tutorial, we will see how we can add backgrounds and different background properties.
Basic code for Colors Properties
<!DOCTYPE html>
<html>
<head>
<title>Background </title>
<link rel=" shortcut icon" href=" favicon.png" >
<link rel=" stylesheet" href=" style.css" >
</head>
<body>
<p class="para"> Mallu Coder Sugu</p>
</body>
</html>
Background Properties and source code :
Property | Code |
Background-color
|
.para { background-color:orange; color:white; } |
Background-image
|
.para { background-image: url('background.jpg'); } |
Other Background Properties:
Property | Description |
background-position: |
background-position is used to set the position of the background. |
background-repeat: |
Used to set the background repetition. |
background-size: |
It is used to set the size of the background. |
background-attachment: |
This property is used to sets whether a background image's position is fixed within the viewport. |
background-origin: |
The background-origin property specifies the origin position of the background. |
Background Shorthand Property
p { Background: #fafafa url("") no-repeat right top; } |
Introduction to CSS Part-2 PDF Click here to download
Easy Pickup
- 1. CSS More Samples
- 2. CSS Malayalam Classes
- 3. CSS Malayalam Notes