Here is an image of what I'm talking about:
Is there a way to get the corners like this using css3 or do I have to resort to images? I believe I saw a tutorial on this somewhere but I can't seem to find it.
The border-radius CSS property rounds the corners of an element's outer border edge. You can set a single radius to make circular corners, or two radii to make elliptical corners.
Do you mean something like this demo fiddle?
HTML:
<div class="box">
<div class="head">
<div class="like"></div>
<h3>User927</h3>
</div>
<div class="cont">
<p>Lorem ipsum...</p>
</div>
<div class="foot">
<a href="">More</a>
</div>
</div>
CSS:
.box {
width: 310px;
position: relative;
}
.head {
background: black;
color: white;
}
.cont {
border-left: 1px solid silver;
border-right: 1px solid silver;
}
.foot {
background: lightgray;
border: 1px solid silver;
border-bottom-width: 3px;
}
.head:before,
.head:after,
.foot:before,
.foot:after {
font-size: 0px;
content: ".";
position: absolute;
}
.head:before {
border-top: 5px solid white;
border-right: 5px solid black;
left: 0;
top: 0;
}
.head:after {
border-top: 5px solid white;
border-left: 5px solid black;
right: 0;
top: 0;
}
.foot:before {
border-bottom: 7px solid white;
border-right: 7px solid transparent;
left: 0;
bottom: 0;
}
.foot:after {
border-bottom: 7px solid white;
border-left: 7px solid transparent;
right: 0;
bottom: 0;
}
Downside: for IE7 you would need extra span's in the markup because the :after
and :before
specifiers are not supported, see this revised fiddle.
I've had great luck with jQuery Corners:
http://malsup.com/jquery/corner/
It can do slanted corners as well as many other varieties, and works well in older browsers too:
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