Here’s what I came up with:
http://www.cutcodedown.com/for_others/antonyx/template.html
The image:
http://www.cutcodedown.com/for_others/antonyx/images/borders.png
You just make wider and redo the math if you want to increase the size. I tweaked the corners, borderline and shadow slightly, hope you don’t mind
as with all my examples the directory:
Index of /for_others/antonyx
Is unlocked for easy access to it’s bits and pieces like the CSS.
Valid XHTML 1.0 Strict, would be valid CSS 2.1 if not for the expression I used to demo the fluid width in legacy IE. Tested working IE 5.5, 6, 7, 8 and 9, FF 3.5 and 4, and the latest flavors each of Opera, Saffy and Chrome. Resize your browser window, and you can see the fluid width in action (set to 608…1248 min/max) – and the content area is fully fluid to any height.
The “eight corners under one roof” method I use is just an expansion on an older concept called “sliding doors” – basically I make three sets of ‘sliding doors’ – header, content and bottom. In order to repeat-y the content it has to go on the left of the image so we can use “top right” to position it… all the others being ‘fixed’ or ‘close enough to fixed’ in height.
Sliding doors is just like it sounds – as they slide apart it gets wider – the two images just overlapping each-other… or in this case, the two slices we are showing of the same image. This unfortunately means at least one of the two images in a sliding doors pair ends up having to be the same as the maximum width you’d want it to display – thankfully if you use .png it is RUTHLESSLY efficient at compressing long horizontal runs of the same pixel if you can use a 8 bit (aka 256 color) file…
Which is why you’ll also note the single .png used comes in at only 1.2k, as opposed to the 12k in four .jpeg you were using on the original. I also took the time to use tweakpng to strip the GAMA line so there are no color matching issues. The low color count of the line-art you are using works well with narrow bit-width png as well, resulting in no real data loss (unlike jpeg which ALWAYS has loss).
I use an overflow cutoff on the floated span in the heading to set it to the maximum allowable height, which I upped to 84px so that at large fonts/120dpi it should still be able to fit two lines of heading text if needed. It may be in your best interest to increase the entire height of the image to around 256px (moving the bottom border down) just to be on the safe side with that, though that depends on your headings.
I moved the text out of the image because images as text is ALWAYS a miserable /FAIL/ at web design, especially on a content area. Don’t get so attached to a font you need to put it in the image
Thankfully yours was pretty simple to code because you aren’t using transparencies – I always count a LACK of transparencies in images as good web design since alpha transparent .png are wastefully large in filesize and have compatibility issues a normal 8 bit .png don’t.
Hope this helps – I know it’s a lot to digest, but this is a really versatile technique that no matter how much code it ends up looking like, it’ll still load many times faster than using multiple separate files thanks to handshaking. SOMEDAY we’ll be able to replace this with CSS3’s border-image – but that won’t be real world deployable IMHO until sometime in 2020 at the rate things are going.
Any questions, fire away.