Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple background images in one div

Tags:

html

css

I made a ribbon in Photoshop. The ribbon has three part. The left and right parts are a fixed 10px. The middle sectoin is a repeatable pattern.

Is it possible to combine these images as the background of my tag?

like image 497
holian Avatar asked Jan 30 '12 20:01

holian


People also ask

Can a div have multiple background images?

CSS allows you to add multiple background images for an element, through the background-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.

How do you put multiple images on a background in HTML?

The multiple background images for an element can be put in the HTML page using CSS. Use CSS background property to add multiple background images for an element in any pattern and use other CSS property to set the height and width of the images.

Which declaration use the correct syntax for applying two background images to the same element?

Which declaration uses the correct syntax for applying two background images to the same element? background-image: url("images/logo.

Which background property allows us to reuse background images in different contexts?

The background-size property specifies the size of the background image. Before CSS3, the background image size was determined by the actual size of the image. In CSS3 it is possible to specify the size of the background image, which allows us to re-use background images in different contexts.


1 Answers

As @j08691 pointed out, this is only possible in CSS3

#your-selector {
  background-image: url(one.png), url(two.png);
  background-position: center bottom, left top;
  background-repeat: no-repeat;
  width: 300px;
  height: 350px;
}

See tutorial

like image 194
MCSI Avatar answered Oct 04 '22 21:10

MCSI