I'm trying to curve an element and then add a background-image
property in it.
I was looking on this question - Is there a way to curve an element?. The only difference, is that I want it to be curved outside.
Here's an example:
This is what I tried to do: http://jsfiddle.net/KcmfC/1148/
The problem in this result is that it's too much curved. I can't find any solution for this.
#test {
background: url('http://www.planwallpaper.com/static/images/i-should-buy-a-boat.jpg') repeat center center / cover;
border: 0px solid #000;
width: 100%;
min-height: 15em;
border-radius: 0 0 100% 100%;
}
<div id="test"></div>
The thing I did is a bit tricky, I stretched the width
to 140% and the I "cut" the edges via overflow: hidden
. Here's my full example:
#test {
position: relative;
overflow: hidden;
min-height: 150px;
}
#test:before {
background: url('http://www.planwallpaper.com/static/images/i-should-buy-a-boat.jpg') repeat center center / 1048px 319px;
border: 0px solid #000;
content: "";
width: 140%;
height: 100%;
border-radius: 0 0 100% 100%;
position: absolute;
z-index: -1;
left: -20%;
right: -20%;
}
<div id="test">
<div>
SOME TEXT SOME TEXT SOME
</div>
</div>