Reputation: 18639
I have this style
<div style="width: 285px; float: right; border: 1px;">
I am expecting there to be a border, but there isn't. Did I do something wrong?
Thanks!
Upvotes: 1
Views: 55
Reputation: 55392
If you don't specify all three border attributes, then you get default values. For the width this happens to be medium
. For the style this is none
, which means you get no border, no matter what the width is. I'm not sure that CSS defines a name for the default colour, but Firefox uses the current text colour.
Upvotes: 0
Reputation: 100331
If you check the CSS reference you will see that border
requires 3 parameters:
border: [width] [style] [color]
The border shorthand property sets all the border properties in one declaration.
The properties that can be set, are (in order): border-width, border-style, and border-color.
It does not matter if one of the values above are missing, e.g. border:solid #ff0000; is allowed.
Upvotes: 3
Reputation: 154838
You seem to be using border-width
. Use border:1px solid black
instead (or something similar).
Upvotes: 3