Genadinik
Genadinik

Reputation: 18639

Html not making a border

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

Answers (4)

Neil
Neil

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

BrunoLM
BrunoLM

Reputation: 100331

If you check the CSS reference you will see that border requires 3 parameters:

border: [width] [style] [color]

border Definition and Usage

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.

See also

Upvotes: 3

chrixian
chrixian

Reputation: 2811

Have to give it a type and a color like border: 1px solid #000

Upvotes: 1

pimvdb
pimvdb

Reputation: 154838

You seem to be using border-width. Use border:1px solid black instead (or something similar).

Upvotes: 3

Related Questions