Forum Moderators: not2easy

Message Too Old, No Replies

graphical borders for images

images borders

         

superbad

12:09 am on Sep 20, 2008 (gmt 0)

10+ Year Member



I want to put a graphical border around images of unknown size. I can do it when I know the size of the image. Note that the way I'm doing it requires the size to be included in both the markup and the CSS. Here's a short example of what I'm dong now:

<!DOCTYPE html PUBLIC "-//W3C//DTD xHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/dtd/xhtml1-strict.dtd">
<html lang="en">

<head>
<title>Framing Images</title>
<style type="text/css">
<!--

.frame {
width: 532px;
height: 365px;
background: url(images/bottom-left.png) no-repeat left bottom;
}

.frame-outer {
background: url(images/bottom-right.png) no-repeat right bottom;
}

.frame-inner {
background: url(images/top-left.png) no-repeat left top;
}

.frame img {
background: url(images/top-right.png) no-repeat right top;
padding: 16px 16px 13px 16px;
}

-->
</style>
</head>

<body>
<div class="frame">
<div class="frame-outer">
<div class="frame-inner">
<img src="images/image.jpg" width="500" height="331" />
</div>
</div>
</div>
</body>

</html>

My goal would be not to have to put the size of the image in either place, and have it size automatically to the image.

Thanks!

swa66

2:28 am on Oct 19, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Slowly browsers like Firefox and Safari are implementing the upcoming CSS3 graphical borders.

So, if you have a degraded version without the graphical borders for the older browsers you could try that avenue.

CSS3 border-image:
[w3.org...]

An example for safari:
[webmasterworld.com...]

Firefox 3.1 is getting similar support (with "-moz-border-image"). Not ethat FF3.1 is still in beta release only.

essiw

1:14 pm on Oct 19, 2008 (gmt 0)

10+ Year Member



it is possible in a table ;) (at least that is how i do that)