View Full Version : Help needed with elastic CSS box using images for borders and corners

10-09-2008, 12:45 PM
I have been driving myself slowly mad for the last 2 days trying to find a way to design this elastic text box. It is made up of 9 transparent .pngs but I am having serious problems getting the side edge classes to set themselves the same height as the centre class which contains the text.

There are currently different situations occurring in IE and FF with IE showing the edges and FF not giving them any height at all. Please excuse the code as it has been a long day of trial and lots of error.

Current state <a href="http://www.keirmcguffogdesign.com/example.html">here</a>.


<div class="boxMiddleRow">
<div class="boxLeftEdge"></div>
<div class="boxCentre">
<div id="lipsum">
<p> Lorem ipsum ...........</p>
<div class="boxRightEdge"></div>

CSS with /* left in so you might be able to see what I've been trying and what doesn't work.

.boxMiddleRow {
position: static;
/*background-image: url(../images/content/textBoxEdgeLeft.png);
background-repeat: repeat-y;*/
width: 100%;

.boxLeftEdge {
background-image: url(../images/content/textBoxEdgeLeft.png);
background-repeat: repeat-y;
position: static;
width: 50px;
left: 0px;
.boxCentre {
background-image: url(../images/content/textBoxCentre.png);
background-repeat: repeat;
/*margin-left: 50px;

.boxRightEdge {
background-image: url(../images/content/textBoxEdgeRight.png);
background-repeat: repeat-y;
position: static;
width: 50px;
right: 0px;

Thanks for any help

10-09-2008, 03:09 PM
I think you're getting too complicated - have a look here at this rounded corner box using graphics (http://www.aguawebs.com/test/box.html) - I've used it many times on lots of sites

10-09-2008, 03:33 PM
Thanks for the reply but I'm after something a bit more complicated. The images I'm using are all .pngs with transparency settings on them. I want to be able to reuse it throughout a site setting different widths and having different amounts of text so I need a way of setting the middle edges heights to be the same as the centre (content) box.

Thanks again

Mr. Pink
10-09-2008, 09:53 PM
I am not sure, and right this second I don't have time to test, but try to put something into the DIV tags that are not showing height. Like this:

<div class="boxLeftEdge"><IMG src="../images/content/textBoxEdgeLeft.png" border="0"></div>


<div class="boxRightEdge"><IMG src="../images/content/textBoxEdgeLeft.png" border="0"></div>

...and also set the height and width (in the IMG tags) to whatever that image is.

Dan Schulz
10-09-2008, 10:45 PM
As I said on SitePoint, you should really look into deathshadow's Eight Corners Under One Roof (http://battletech.hopto.org/html_tutorials/eightcorners/template.html).

10-10-2008, 08:37 AM
Hello again and thanks for all the replies. Sorry to keep bothering but all is not well with me yet. I've scrapped the transparent and am going with the "Eight Corners Under One Roof" that Dan suggested. However I've hit another brick wall. I've followed the tutorial to the T and have only jigged the heights to work with my image.

Thanks again and if anyone can spot what's wrong a gold star is winging it's way to you.

link (http://www.keirmcguffogdesign.com/box.html)