Html – How to set a border for an HTML div tag

bordercsshtml

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:

<div id="divActivites" name="divActivites" style="border:thin">
    <textarea id="inActivities" name="inActivities" style="border:solid">
    </textarea> 
</div> 

How do I set a border for an HTML div tag?

Best Answer

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.