/    Sign up×
Community /Pin to ProfileBookmark

images in CSS borders?

Is it possible to put an image into a CSS border? I keep trying but it won’t take! Maybe my image isn’t exactly the pixel dimensions it should be?

Thanks

to post a comment
CSS

5 Comments(s)

Copy linkTweet thisAlerts:
@WebJoelMay 04.2006 — What code do you have so far? Is this for any border, or a specific border, like a left border, bottom border, etc.?

What should work is something like:

[CODE]border-image: url("border.png")[/CODE] and some specificity as to placing it (repeat, repeat-x or repeat-y, etc.)
Copy linkTweet thisAlerts:
@Little_GoatMay 04.2006 — I don't think there is a property that does that. if there is, it is this:
<i>
</i>border: url(yourimage.jpg);

LG
Copy linkTweet thisAlerts:
@WebJoelMay 04.2006 — I don't think there is a property that does that. ...LG[/QUOTE]

I wasn't sure either, until I looked it up. It's still bleeding-edge and probably not useful to most browsers yet...

See:

http://www.w3.org/TR/css3-background/#the-border-image
Copy linkTweet thisAlerts:
@machineghostMay 04.2006 — Since (for all practical purposes) there is no border-image, your best bet would probably be to throw the image inside a div, set that div's background image to your border image, and then give the div padding (or give the image a margin) equal to your desired border width.
Copy linkTweet thisAlerts:
@tommyjayauthorMay 04.2006 — Thanks!

I'll have to check code out when I'm home!
×

Success!

Help @tommyjay spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...