I've been trying to get a CSS shape working cross browser, I've got it working in Chrome and Safari without any issues, I cannot seem to get it working in Firefox (not tested IE yet, not looking forward to that).
Here is the HTML:
<div class="container">
<section class="hero">
<section class="slide">
<div class="shaped"></div>
<div class="hero-text">
<h2>PROFESSIONAL PROPERTY MAINTENANCE SERVICES FOR BUSINESSES</h2>
<p>Throughout the Northwest of England including Liveprool, Manchester, Preston, Wigan and St. Helens</p>
</div>
</section>
</section>
</div>
Here is the CSS:
.container {
width: 960px;
margin: 0 auto;
}
section.hero {
padding: 8px;
box-sizing: border-box;
overflow: hidden;
width: 100%;
height: 400px;
float:left;
section.slide {
position:relative;
.shaped {
background-size: cover;
shape-outside: polygon(20% 0, 100% 0, 100% 100%, 0% 100%);
clip-path: polygon(20% 0, 100% 0, 100% 100%, 0% 100%);
background-image: url(http://www.e-architect.co.uk/images/jpgs/aberdeen/bon_accord_centre_tonyfreeman221207_04.jpg);
height: 384px;
float:left;
width: 70%;
float: right;
shape-margin: 20px;
}
.hero-text {
box-sizing: border-box;
background-color: #333;
color: white;
padding: 30px;
height: 384px;
width: 50%;
h2 {
margin-bottom: 20px;
}
}
}
}
I've tried an Adobe shape polyfill which didnt make any difference, is there any other options for this or should I be considering changing the design altogether?
Thanks
You could use
svg
'sclipPath
for cross-browser support.You could add curves instead of a straight line using this approach.
Here are some examples.
I would suggest changing the approach all together, shape-outside isn't supported by FF or IE yet and you can achieve this layout with simple transforms on a pseudo element :
DEMO
The transform property is supported by IE9+. More info on canIuse