div简介

There are several HTML elements that I have not introduced to this point because without CSS they have little point, and almost no meaning. These elements include span and div.

到目前为止,我还没有介绍几个HTML元素,因为没有CSS,它们几乎没有意义,也几乎没有意义。 这些元素包括spandiv

div is arguably the most overused and misunderstood element in the HTML5 specification, so let’s try to kill a few common mistakes right off the bat:

div可以说是HTML5规范中使用最广泛和最容易理解的元素,因此让我们尝试立即消除一些常见错误:

<div> is a <div>"container of last resort" “不得已的容器”
It's an element used after all other section elements have been eliminated.
这是 在除去所有其他section元素之后使用的 元素
<div> you can do to any other element<div>做的任何事情都可以对任何其他元素做的事情
<div> is not special in that regard. You do not need to use a <div>并不特殊。 您无需使用 <div> in order to access advanced CSS such as <div>即可访问高级CSS(例如 positioning. positioning)
<div> should almost never contain a single element<div>几乎不应包含单个元素
<div> can be applied to any other element, wrapping a <div>进行的任何操作都可以应用于任何其他元素,所以将 <div> around a single element is almost always redundant and unnecessary. <div>包裹在单个元素上几乎总是多余且不必要的。
<div> is not a substitute for, or addition to, a block or section element<div>不能替代或添加块或节元素
<ul>. Wrapping a <ul> 。 将 <div> around the <div>包裹在 <ul> is redundant. <ul>周围是多余的。
<div> to create an extra border around an element<div>在元素周围创建额外的边框
Use a combination of outline and box-shadow instead.
而是 使用outline box-shadow 的组合
Avoid setting height on any element, other than images). 避免在image之外的任何元素上设置height )。
height: 100%, allow height: 100% ,允许 <div> elements to find their own height, determined by their content. <div>元素根据其内容确定自己的高度。

翻译自: https://thenewcode.com/57/Introduction-to-divs

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值