Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


CSS3 Border-image tutorial?

Hi Treehouse

I've always struggled to get to grips with the new CSS3 border-image property. I've been looking through the library and can't find anything relating to the technique.


Is there a tutorial or deepdive available on the subject?

Many thanks Dan

3 Answers

The css foundations deep dive covers this topic in depth (under backgrounds and borders) my friend. It's probably some of the most in-depth coverage of this topic that I've ever seen.

Thanks Travis

Exactly what I was looking for, just used it on a stage site and it works a charm!

Eleeza Amin
Eleeza Amin
34,496 Points

Hi, Daniel! The first thing you need to do is to make sure that your browser supports support border-image. (You can use Internet Explorer 11, or the most recent version of your chosen browser).

Next, you need to specify the image you want as a border, using its url()

Finally, you need to specify the width, height and if you want to stretch, or repeat ( use round) the image that you're using for the border.

border-image: url(/* Image url */) 30 40 stretch;

The first number (30) refers to the width The second number (40) refers to the height

When you are done, your syntax should look something like this: -webkit-border-image:url(/* Image url */) 30 40 /*styling the image*/; /* Safari 5 */ -o-border-image:url(/* Image url */) 30 40 /*styling the image*/; /* Opera */

I hope this will help you.