Forum Moderators: not2easy

Message Too Old, No Replies

border-color doesn't have any effect?

         

mongoloid001

10:19 pm on Sep 4, 2003 (gmt 0)

10+ Year Member



Isn't:

border-top: 2px;
border-right: 1px;
border-bottom: 2px;
border-left: 1px;
border-color:solid purple;
background-color: silver;

The same as:

border-top: 2px solid purple;
border-right: 1px solid purple;
border-bottom: 2px solid purple;
border-left: 1px solid purple;
background-color: silver;

But the first one didn't work in IE. Why?

Also:


border-top: 2px #A52A2A;
border-right: 1px #A52A2A;
border-bottom: 2px #A52A2A;
border-left: 1px #A52A2A;
background-color: silver;

doesn't work. Wonder why?

(by not working, i mean that the border-color wasn't set as intended:( )

Thanks in advance!

[edited by: Nick_W at 10:26 pm (utc) on Sep. 4, 2003]
[edit reason] Just made it more readable... [/edit]

SuzyUK

8:15 am on Sep 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There are 3 border properties:
  • border-width
  • border-style
  • border-color

    all three should be set to produce the effect.

    If you are then Using shorthand properties

  • border
  • border-top
  • border-right
  • border-bottom
  • border-left

    You need to specify the 3 Values.

    So to answer your question..
    The first example is not the same as the second.

    border-color:solid purple;
    in your first rule is incorrect.

    solid is not a border-color it is a border-style

    Your 3rd example

    border-top: 2px #A52A2A;
    border-right: 1px #A52A2A;
    border-bottom: 2px #A52A2A;
    border-left: 1px #A52A2A;

    won't work because you haven't specified a border-style in there..
    shorthand properties should be set:
    [border-width ¦¦ border-style ¦¦ border-color]

    and as the default(initial) Value of border-style is none that's what's happening, you're getting no border ;)

    One way to shorten this would be:


    border-width: 2px 1px;
    border-style: solid;
    border-color: #a52a2a;
    background-color: silver;

    or use the second example.. it's correct too..

    Suzy

  • mongoloid001

    7:21 pm on Sep 5, 2003 (gmt 0)

    10+ Year Member



    Thanks! Wow, clear explanation. I figured out that I need to put a 'solid' in between, but didn't understand why it worked:).

    Filipe

    10:28 pm on Sep 5, 2003 (gmt 0)

    10+ Year Member



    Also, it can be shortened to read as such:


    border: 2px 1px 2px 1px solid purple;
    background-color: silver;

    SuzyUK

    11:18 pm on Sep 5, 2003 (gmt 0)

    WebmasterWorld Senior Member 10+ Year Member



    ooops Filipe I don't think so..

    which browser exactly does that work in?