Does anyone have a modern CSS method for doing something like this? I've been searching for ages. Maybe I'm using the wrong search terms?
http://fu2k.org/alex/css/equalheight/divs/clipped
UPDATE:
Thanks to all for the replies & comments. Unfortunately the background of my div is patterned and has a thin solid border so this seems to rule out a lot of suggestions. I'm still exploring the ideas. Perhaps a javascript approach is a possibility?
You can achieve this with pure CSS - cross-platform, working down to IE7 (I haven't tested this with IE6, but I think it should still work).
<style type="text/css">
<!--
div.big {
position: relative;
width: 600px;
height: 200px;
background:#FFF url(images/pattern.png)
border: solid 1px black;
}
div.top-left-b {
width: 0;
height: 0;
position: absolute;
top: 0px;
left: 0px;
border-top: solid 40px black;
border-right: solid 40px transparent;
z-index: 1;
}
div.top-left-w {
width: 0;
height: 0;
position: absolute;
top: -1px;
left: -1px;
border-top: solid 40px white;
border-right: solid 40px transparent;
z-index: 2;
}
div.top-right-b {
width: 0;
height: 0;
position: absolute;
top: 0px;
right: 0px;
border-top: solid 40px black;
border-left: solid 40px transparent;
z-index: 1;
}
div.top-right-w {
width: 0;
height: 0;
position: absolute;
top: -1px;
right: -1px;
border-top: solid 40px white;
border-left: solid 40px transparent;
z-index: 2;
}
div.bottom-left-b {
width: 0;
height: 0;
position: absolute;
bottom: 0px;
left: 0px;
border-bottom: solid 40px black;
border-right: solid 40px transparent;
z-index: 1;
}
div.bottom-left-w {
width: 0;
height: 0;
position: absolute;
bottom: -1px;
left: -1px;
border-bottom: solid 40px white;
border-right: solid 40px transparent;
z-index: 2;
}
div.bottom-right-b {
width: 0;
height: 0;
position: absolute;
bottom: 0px;
right: 0px;
border-bottom: solid 40px black;
border-left: solid 40px transparent;
z-index: 1;
}
div.bottom-right-w {
width: 0;
height: 0;
position: absolute;
bottom: -1px;
right: -1px;
border-bottom: solid 40px white;
border-left: solid 40px transparent;
z-index: 2;
}
-->
</style>
<div class="big">
<div class="top-left-b"><!-- --></div>
<div class="top-left-w"><!-- --></div>
<div class="top-right-b"><!-- --></div>
<div class="top-right-w"><!-- --></div>
<div class="bottom-left-b"><!-- --></div>
<div class="bottom-left-w"><!-- --></div>
<div class="bottom-right-b"><!-- --></div>
<div class="bottom-right-w"><!-- --></div>
</div>
This would produce the following effect:

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With