How to set a border for an HTML div tag

前端 未结 9 845
予麋鹿
予麋鹿 2021-01-29 22:06

I am trying to define a border around a div tag in HTML. In some browsers the border does not appear.

Here is my HTML code:

9条回答
  •  不思量自难忘°
    2021-01-29 22:47

    Try being explicit about all the border properties. For example:

    border:1px solid black;
    

    See Border shorthand property. Although the other bits are optional some browsers don't set the width or colour to a default you'd expect. In your case I'd bet that it's the width that's zero unless specified.

提交回复
热议问题