5 Replies - 3901 Views - Last Post: 15 January 2010 - 12:45 PM

#1 dangmnx   User is offline

  • D.I.C Regular

Reputation: -1
  • View blog
  • Posts: 428
  • Joined: 10-April 09

CSS: Border with image

Posted 14 January 2010 - 08:13 PM

Hi, how can i add images around my css border on each side, top, left, bottom.

here is what i have right now

}
#header {
 color: #333;
 width: 900px;
 float: left;
 padding: 10px;
 border: 1px solid #ccc;
 height: 100px;
 margin: 10px 0px 5px 0px;
 background-image:url('images/header.png');
}


i just want something like
border-left: img(1.png)
border-right: img(1.png)
border-top: img(1.png)
border-bottom: img(1.png)

thx!

Is This A Good Question/Topic? 0
  • +

Replies To: CSS: Border with image

#2 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6968
  • View blog
  • Posts: 31,958
  • Joined: 10-May 07

Re: CSS: Border with image

Posted 14 January 2010 - 08:15 PM

img
{
border-top-style:solid;
border-right-style:solid;
border-bottom-style:solid;
border-left-style:solid;
}


Oh, you are trying to use the image as the boarder....
hrm. Dunno. Scratch the above, sorry.
Was This Post Helpful? 0
  • +
  • -

#3 dangmnx   User is offline

  • D.I.C Regular

Reputation: -1
  • View blog
  • Posts: 428
  • Joined: 10-April 09

Re: CSS: Border with image

Posted 14 January 2010 - 08:24 PM

#header {
 color: #333;
 width: 900px;
 float: left;
 padding: 10px;
 height: 100px;
 margin: 10px 0px 5px 0px;
 background-image:url('images/header.png');
 border-top-image:url('images/top.png');
 border-bottom-image:url('images/bottom.png');
 border-right-image:url('images/right.png');
 border-left-image:url('images/left.png');
}


nothing came up :(
Was This Post Helpful? 0
  • +
  • -

#4 BetaWar   User is offline

  • #include "soul.h"
  • member icon

Reputation: 1695
  • View blog
  • Posts: 8,592
  • Joined: 07-September 06

Re: CSS: Border with image

Posted 15 January 2010 - 08:38 AM

Ya, borders don't currently allow for images to be used, however you may try to do something like so:
<style>
.holderDiv{
  background: url('images/border.png') top left no-repeat transparent;
  width: 300px;
  height: 300px;
}
.contentDiv{
  width: 290px;
  height: 290px;
  margin: 5px;
}
</style>

<div class="holderDiv">
  <div class="contentDiv">
	Content goes here.
  </div>
</div>


NOTE - Untested

The only real downside to this method if you must know how large the content will be beforehand or it won't look right.

Hope that helps.
Was This Post Helpful? 0
  • +
  • -

#5 hadi_php   User is offline

  • D.I.C Regular
  • member icon

Reputation: 10
  • View blog
  • Posts: 382
  • Joined: 23-August 08

Re: CSS: Border with image

Posted 15 January 2010 - 08:48 AM

div.test { border:1px solid url(yourpath/image.jpg) }
Was This Post Helpful? 0
  • +
  • -

#6 Lemur   User is offline

  • Pragmatism over Dogma
  • member icon


Reputation: 1453
  • View blog
  • Posts: 3,633
  • Joined: 28-November 09

Re: CSS: Border with image

Posted 15 January 2010 - 12:45 PM

Look into rounded corner methods for CSS, it might help. I believe that the multi image border you're describing is CSS3, but it's pretty far out to even think about using.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1