Code Snippet
“Stitched” Look
.stitched {
padding: 5px 10px;
margin: 10px;
background: #ff0030;
color: #fff;
font-size: 21px;
font-weight: bold;
line-height: 1.3em;
border: 2px dashed #fff;
border-top-left-radius: 3px;
-moz-border-radius-topleft: 3px;
-webkit-border-top-left-radius: 3px;
border-bottom-right-radius: 3px;
-moz-border-radius-bottomright: 3px;
-webkit-border-bottom-right-radius: 3px;
border-top-right-radius: 3px;
-moz-border-radius-topright: 3px;
-webkit-border-top-right-radius: 3px;
-moz-box-shadow: 0 0 0 4px #ff0030, 2px 1px 4px 4px rgba(10,10,0,.5);
-webkit-box-shadow: 0 0 0 4px #ff0030, 2px 1px 4px 4px rgba(10,10,0,.5);
box-shadow: 0 0 0 4px #ff0030, 2px 1px 6px 4px rgba(10,10,0,.5);
text-shadow: -1px -1px #aa3030;
font-weight: normal;
}
Reference URL
looks pretty awesome!!
This is a great trick!
The “key” to this look is just the line “border: 2px dashed #fff;” in case anyone wondered what were going on up there…
Well sure, but how did the border get INSIDE the element, or how did the background get out of it?
I don’t see any background-origin here…
That’s the box-shadow.
Looks great! I think it looks even better with this added. :-)
border-bottom-left-radius: 3px 3px;
it is really good one
Great snippet
but it is not working in ie 7 and 8,
any solution please?
IE7 and IE8 don’t support CSS3, which this uses.
Use CSS3 PIE: http://css3pie.com/
Thanks for information guys
Looks great! Thank you
I would have used a much simpler example to demonstrate the stitched look
The trick to get the background color to bleed over the border is the spreadradius of box-shadow (the 4rth element, which here I set to 8px)
i wish these posts had visual examples :/
Try it out as a visual example.
border:
If your element is not using rounded corners, and you don’t care about IE6/7 support, then you could do this using a dashed border and the outline property, instead of a box shadow. Syntax-wise it’s a little simpler, but roughly the same effect.
But if you use rounded corners, then you can’t use outline because it will look weird. ;)
For browser compatibility, you can turn that long code into this
.stitched{
border:2px dashed #fff;
background: #ff0030;
box-shadow: 0 0 0 8px #ff0030;
}
That’s the main key, for some style…it’s all up to you..
webkit doesnt work in explorer…ban IE…hehehe
DigWP
A book and blog co-authored by Jeff Starr and myself about the World's most popular publishing platform.
Quotes on Design
Design, like Art, can be an elusive word to define and an awfully fun thing to have opinions about.
HTML-Ipsum
One-click copy to clipboard access to Lorem Ipsum text that comes wrapped in a variety of HTML.
Bookshelf
Hey Chris, what books do you recommend? These, young fertile mind, these.