6/7/21

CSS Tutorials :- CSS Background Property Part 1

CSS Background – CSS Property 

CSS Background property is used to define the background effects on the Html elements. There are 5 types of CSS Property that you can use it on the elements these are:- 

  1. Background-Color
  2. Background-image
  3. Background-repeat
  4. Background-position
  5. Background-attachment

CSS Background Color

This CSS property set the background color of any Html element in which the background property is used. 

Example:- 

<html>
<head>
    <title> CSS Background Property </title>
    <style>
        * {
            colorred;
        }

        h1 {
            background-coloryellow;
        }

        h2 {
            background-colorgreen;
        }

        p {
            background-colorblue;
        }
    </style>
</head>
<body>
    <h1> CSS Background Color Property.</h1>
    <h2> This is 2nd Heading.</h2>
    <p> This is a Paragraph. </p>
</html>

Output :- 

CSS Background Image 

This CSS Background Property is used to set an image as a background. You can set any type of image as a background of a html document. Just you need to enter the url or that image into you html documents.

Example:-

<html>
<head>
    <title> CSS Background Property </title>
    <style>
        body {
            background-imageurl(ex.jpg);
        }
    </style>
</head>
<body>
    <h1> CSS Background Color Property.</h1>
    <h2> This is 2nd Heading.</h2>
    <p> This is a Paragraph. </p>
</body>
</html>

Output:-



1 comment:

  1. Wow i can say that this is another great article as expected of this blog.Bookmarked this site.. real estate photography

    ReplyDelete

Like us on facebook

blogger templatesblogger widgets

Follow on Twitter

Linkedin

Categories

Mad About Computer. Powered by Blogger.