html div 属性_div(HTML属性)

html div 属性

描述 (Description)

The div is a generic block-level element. It doesn’t convey any meaning about its contents (unlike a p element that signifies a paragraph, or an h1 or h2 element that would indicate a level 1 or level 2 heading, respectively); as such, it’s easy to customize it to your needs. The div element is currently the most common method for identifying the structural sections of a document and for laying out a web page using CSS.

div是通用的块级元素。 它没有传达任何有关其内容的含义(不同于表示段落的p元素,或分别表示1级或2级标题的h1h2元素); 这样,很容易根据您的需要对其进行自定义。 div元素是当前用于识别文档的结构部分以及使用CSS布置网页的最常用方法。

Some developers perceive similarities between the p and the div elements, seeing them as being interchangeable, but this isn’t the case. The p element offers more semantic information (“this is a paragraph of text, a small collection of thoughts that are grouped together; the next paragraph outlines some different thoughts”), while the div element can be used to group almost any elements together. Indeed, it can contain almost any other element, unlike p, which can only contain inline elements.

一些开发人员认为pdiv元素之间存在相似之处,认为它们是可互换的,但事实并非如此。 p元素提供了更多的语义信息(“这是一段文本,少量的思想被组合在一起;下一段概述了一些不同的思想”),而div元素可用于将几乎所有元素组合在一起。 实际上,它可以包含几乎任何其他元素,不像p ,后者只能包含内联元素。

(Example)

The HTML below shows two divs being used in conjunction with id attributes to identify different sections of a web page:

以下HTML显示了两个divid属性一起使用,以标识网页的不同部分:

<div id="main_navigation">
</div>
<div id="body_content">
  <h1>Page heading</h1>
  <p>Body content</p>
</div>

将此用于… (Use This For …)

The div is an “anything-goes” element—it can contain any inline or block-level elements you choose, so it has no typical content.

div是一个“万事通”元素-它可以包含您选择的任何内联或块级元素,因此没有典型的内容。

兼容性 (Compatibility)

Internet ExplorerFirefoxSafariOperaChrome
5.56.07.08.01.01.52.03.03.51.32.03.14.09.29.510.02.0
FullFullFullFullFullFullFullFullFullFullFullFullFullFullFullFullFull
IE浏览器 火狐浏览器 苹果浏览器 歌剧 Chrome
5.5 6.0 7.0 8.0 1.0 1.5 2.0 3.0 3.5 1.3 2.0 3.1 4.0 9.2 9.5 10.0 2.0
充分 充分 充分 充分 充分 充分 充分 充分 充分 充分 充分 充分 充分 充分 充分 充分 充分

This element has no compatibility issues. All the browsers listed support the div element.

该元素没有兼容性问题。 列出的所有浏览器都支持div元素。

翻译自: https://www.sitepoint.com/div-html-attribute/

html div 属性

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值