如何为HTML div标签设置边框 [英] How to set a border for an HTML div tag

查看:880
本文介绍了如何为HTML div标签设置边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在HTML中定义div标记周围的边框。在某些浏览器中,边框不会出现。

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

以下是我的HTML代码:

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

如何为HTML div标签设置边框?

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

推荐答案

尝试对所有边框属性显式。例如:

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.

这篇关于如何为HTML div标签设置边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆