Huh, for whatever reason those borders aren't rendrering on my desktop machine... wonder if my adblock doesn't like them or something.
To implement the same thing, I'd have done it a touch different using CSS. No tables involved, and might be a touch easier to follow.
the CSS:
Code:
.left_shadow {
background:url(images/left_side_shadow.gif) top left repeat-y;
}
.left_shadow_top {
background:url(images/left_top_shadow.gif) top left no-repeat;
}
.bottom_shadow {
background:url(images/bottom_shadow.gif) bottom left repeat-x;
}
.bottom_shadow_left {
background:url(images/left_bottom_shadow.gif) bottom left no-repeat;
}
.bottom_shadow_right {
background:url(images/right_bottom_shadow.gif) bottom right no-repeat;
padding:0px 0px 10px 10px; /* bottom and left shadow widths */
}
.content {
border:1px solid #888;
padding:8px;
}
and the HTML
Code:
<div class="left_shadow">
<div class="left_shadow_top">
<div class="bottom_shadow">
<div class="bottom_shadow_left">
<div class="bottom_shadow_right">
<div class="content">
Some test content here<br />
Some test content here<br />
Some test content here<br />
Some test content here<br />
Some test content here<br />
</div>
</div>
</div>
</div>
</div>
</div>
'how it works'
By constantly layering one DIV atop another, the images get depth-sorted atop each-other. This let's the corner images 'overwrite' the tiled images, which we use the background-position to place instead of floats and/or table elements. We then just have to pad the innermost div BEFORE the content one to push the content in from the shadows. You SHOULD in theory be able to do the same using margins on the content to push it in, but for some reason Opera and FF ignore bottom-margin for SIZING DIV's unless they are position:relative (though it DOES pay attention for spacing them - ARGH!!!)... rather than add position:relative and making even MORE code, I opted for the padding instead.
I think using a 'sliding doors' technique might let you reduce the number of images involved, perhaps all the way down to one, but more likely with just two images... Personally I'd probably make it three images, but make code to allow borders on all four sides... one image would have all four rounded corners in it, while another would be the repeat-y images, and another the repeat-x... in that case you'd have to assign a background to the content area, otherwise the extra borders would show through.
If I have some time tomorrow, I'll toss together an example of that way and pop it onto my server.
SUCKS to nest DIV's that deep, but it beats using 3-6k in images on sliding-doors to pull off what 1k of images can do... to do something with NEITHER tables nor floats, and it's always nice to be FULLY dynamic letting you make your content any size you like.
Bookmarks