How to make a DIV with image borders

Discussion in 'HTML & Website Design' started by mcdeere02, Aug 7, 2009.

Thread Status:
Not open for further replies.
  1. #1
    Is it possible to make a DIV that, regardless of dimensions, always has a "border" around it consisting of images?

    Like say I want to make a DIV appear framed, and have 4 images:

    - top frame
    - bottom frame
    - left frame
    - right frame

    Is there a way to make each one act as a background image, and float to its appropriate corner? Or some other solution to this problem?

    The images will be of a nature where the length of the sides of the given DIV won't matter, so no worries there.
     
    mcdeere02, Aug 7, 2009 IP
  2. thedanielsolution

    thedanielsolution Peon

    Messages:
    43
    Likes Received:
    0
    Best Answers:
    2
    Trophy Points:
    0
    #2
    This is completely possible. Using CSS, simply set the background-url: to each image. If you send the images I can probably take care of it for you.

    D
     
    thedanielsolution, Aug 7, 2009 IP
  3. justinlorder

    justinlorder Peon

    Messages:
    4,160
    Likes Received:
    61
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Just set the border for the wrapped DIV element .
    I suggest the following css code, try it.

    border {
    1px solid #999;
    }
     
    justinlorder, Aug 7, 2009 IP
  4. Kazumael

    Kazumael Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    In CSS 3 you'll be able to do this right in your style sheet. At the moment, this functionality is only available in Safari and Firefox (and maybe Chrome, since it uses the same rendering engine as Safari).

    For example:
    border-image: url(border.png) 27 27 27 27 stretch stretch;
    Code (markup):
     
    Kazumael, Aug 7, 2009 IP
  5. 1 FineLine

    1 FineLine Peon

    Messages:
    78
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5

    why use images and waste bandwidth? Justin makes a valid case for using borders. :)
     
    1 FineLine, Aug 7, 2009 IP
Thread Status:
Not open for further replies.