Email
Share

We Rock Your Web Forum » Markup Languages » CSS

CSS Image as Border?

(2 posts)
  1. Sally301

    member
    Joined: Aug '09
    Posts: 28

    Is it possible to use a background image in a border, as follows: #line { border: 2px solid #999 url(border.gif) repeat-x }?

    That doesn't seem to work - neither the line nor the image appear...

    Posted 1 year ago #

  2. Posted 1 year ago
  3. cwd

    senior admin
    Joined: Jul '09
    Posts: 225

    It is possible, but you need to specify height and width, as follows:

    #line { width: 100%; height: 2px; background: #999 url(border.gif) repeat-x }

    This example assumes that your pixel graphic is 2px tall, and 1px wide (you can make it wider, but to reduce the size of the image, if you're only using two colors, you can make it 1px wide and then use repeat-x to create the line).

    Posted 1 year ago #

RSS feed for this topic

Reply

(required)

Allowed markup: BBcode blockquote code em strong ul ol li font strike center u hr.
You can also put code in between backtick ( ` ) characters.