CSS3 Border Color / Colour

css3 border color

Give your borders a more color / colour filled effect with CSS3 using the border-color property.

CSS3 Border Color

Using CSS3 border-color, if you have a standard border of X pixels, then you can use up to X colors on that border, each color registering 1 pixel in width. If say you are using a standard border of 10 pixels but only apply 5 or 6 colors, the last color will then be applied to the remaining standard border width.

Cross Brower Compatability
Currently FireFox is the only browser giving support to the CSS3 border-colour so we will only be dealing with the -moz prefix.
All articles in the CSS3 will be updated to show future support & development.

CSS3 Border Color

This is a panel set with a 10 pixel standard border and border-colors

  1. CSS3 Border Color (Standard Border)
  2. #my_CSS3_id {
  3.   border: 10px solid #c4c8cc;
  4.   -moz-border-bottom-colors: #300 #600 #700 #800 #900 #A00;
  5.   -moz-border-top-colors: #300 #600 #700 #800 #900 #A00;
  6.   -moz-border-left-colors: #300 #600 #700 #800 #900 #A00;
  7.   -moz-border-right-colors: #300 #600 #700 #800 #900 #A00;
  8. }

An example for those on alternative browsers, not seeing the border-colour effect..

 

CSS3 Border Color (with rounded corners)

This is a panel set with a 10 pixel standard border, border-colors and a border-radius

  1. CSS3 Border Color (Rounded Corners)
  2. #my_CSS3_id {
  3.   border: 10px solid #c4c8cc;
  4.   -moz-border-radius: 25px 0px;
  5.   -moz-border-bottom-colors: #303 #404 #606 #808 #909 #A0A;
  6.   -moz-border-top-colors: #303 #404 #606 #808 #909 #A0A;
  7.   -moz-border-left-colors: #303 #404 #606 #808 #909 #A0A;
  8.   -moz-border-right-colors: #303 #404 #606 #808 #909 #A0A;
  9. }

An example for those on alternative browsers, not seeing the border-colour effect..

 

The Zen Elements CSS3 Series

Thank you for reading!
Alex | @ZenElements

Like this article?

Subscribe to our rss, follow our tweets or please help us spread the work & share this with your friends!

Thank you for all your support; have a cookie!

6 Comments on “CSS3 Border Color / Colour”

  1. ???bishua? 12.08.2010 at 7:27 am

    artical is very useful!

  2. Jayuh 27.09.2010 at 9:59 am

    there was some wrong with the second example:
    the border-radius code should be: -moz-border-radius: 25px 0px 25px 0px;

  3. Zen Elements 05.10.2010 at 2:46 pm

    @Jayuh – thank you for noticing and pointing out that little mistake – amended!

  4. jaggu 27.05.2011 at 5:11 am

    I am very happy to make this elements in css,

    But why its not supporting in Internet Explore??

  5. HautStyle 05.10.2011 at 3:52 pm

    That’s very handy! Thanks for sharing

  6. Ali 29.09.2012 at 11:58 pm

    Thanks for article.

 

Leave a Reply

(required; who are you?)

(required; we'll keep it safe!)

(optional; promote your site!)