CSS/HTML CSS3 Multiple Backgrounds image Code For Website - Learn About Website | DaddyFile

0

CSS3 Multiple Backgrounds Explain

CSS3 allows you to add multiple background images for an element, through thebackground-image property.
The different background images are separated by commas, and the images are stacked on top of each other, where the first image is closest to the viewer.
The following example has two background images, the first image is a flower (aligned to the bottom and right) and the second image is a paper background (aligned to the top-left corner):

Multiple background images can be specified using either the individual background properties (as above) or the background shorthand property.
The following example uses the background shorthand property (same result as example above):


Html Code:

<!DOCTYPE html>
<html>
<head>
<style>
#example1 {
    background-image: url(img_flwr.gif), url(paper.gif);
    background-position: right bottom, left top;
    background-repeat: no-repeat, repeat;
    padding: 15px;
}
</style>
</head>
<body>

<div id="example1">
<h1>Lorem Ipsum Dolor</h1>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
<p>Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</p>
</div>

</body>
</html>







Html Code Result:






Post a Comment

 
Top