Hi I'm trying to create the following Angled Strip Look in HTML & CSS:
Just the Blue and Purple area with white after.
I can obviously see how to do it using an image but what about HTML/CSS only?
Is this possible?
Its used on the site - www.africa.dating
I know I should have more example code but I'm actually not sure where to begin so I only have the following HTML:
Fiddle: http://jsfiddle.net/e2dr5udr/3/
<div id="container">
<div id="blue"></div>
<div id="purple"></div>
</div>
#container {
width: 100%;
height: 100px;
background-color: white;
position: absolute;
}
#blue {
width: 100%;
height: 100px;
background-color: blue;
position: absolute;
}
#purple {
width: 100%;
height: 100px;
background-color: purple;
position: absolute;
}
thankyou
Here is a demo of what you want: http://jsfiddle.net/shivanraptor/c4vrLrq7/
Basically it's a Square (
#blue
), Triangle (#triangle
), Parallelogram (#parallelogram
)You can use a pseudo element and some border manipulation.
This would allow you to create it with only a single element, to create this:
If you do not want to use this approach, an alternative method (using background gradients) can be viewed here
Using SkewX:
If you want a
background-image
, you could make use ofrgba()
values and a :pseudo-element.The idea is to apply the
background-image
to an:after
:pseudo-element and thelinear-gradient
withrgba()
values on the maindiv
.You could change the opacity of the
linear-gradient
by changing the alpha value inrgba(red, green, blue, alpha)
An other approach using one element, the
skewX()
property for the slope right side, the transparency is made withrgba()
background-color and border on a pseudo element :DEMO