I have the following HTML / CSS code:
<div class="tip">
Some tip text
</div>
div.tip {
background: green url("green-tip.png") no-repeat center bottom / 100% auto;
border-radius: 4px;
}
Basically I need to replicate the design:
The green-tip.png
is just the pointer in the bottom:
However I get only a rectangle with round corners without the pointer in the bottom.
How to do this?
4
Answers
you can write like this
If you want the image to be part of the background as well, a simple (not necessarily most extendable) way of doing this would be to set both as background divs and place them in vertical block together
CSS
Here’s your rectangle style class:
Here’s your image style class:
HTML
An easy way to do this would be to add another div at the bottom:
Another way, using
::after
pseudoelement (useful if you want to use it in several places on your site):Use multiple background layer: