html5快捷键_HTML5快捷键

html5快捷键

HTML 5 is somewhat looser in its requirements for markup compared to XHTML, allowing a number of shortcuts:

与XHTML相比,HTML 5对标记的要求稍微宽松一些,允许许多快捷方式:

  • Tags can be written uppercase, lowercase, or in mIxEd case.

    标签可以大写,小写或混合大小写。
  • You can drop a lot of closing tags: </li>, </dt>, </dd>, </tr>, </th>, </td>, </thead>, </tfoot>, </tbody>, </option>, </optgroup>, </p> (in most cases), </head>, </body> and </html> are not required.

    您可以删除许多结束标记: </li></dt></dd></tr></th></td></thead></tfoot></tbody></option></optgroup></p> (在大多数情况下), </head></body></html>是不需要的。

  • Attribute values only need to be quoted if they contain spaces or some non-alphanumeric characters (such as a question mark). So <div id=wrapper> is legitimate, as is <img src=assets/images/falls.jpg …> but <img alt=Angel Falls …> is not.

    如果属性值包含空格或某些非字母数字字符(例如,问号),则只需将其引起引用。 因此, <div id=wrapper>是合法的, <img src=assets/images/falls.jpg …><img alt=Angel Falls …>是不合法的。

  • No type attribute is required on scripts or stylesheets: a link to a CSS file can be written as <link rel=stylesheet href=styles.css>

    脚本或样式表上不需要type属性: CSS文件的链接可以写为<link rel=stylesheet href=styles.css>

You will see these shortcuts used in some code examples on this blog in order to save space. If web development is new to you I strongly suggest that you stick to the basic rules for writing HTML code. (Your web page will continue to work fine, and the code will likely be easier for you to read). Once you’re familiar with HTML, you can start to introduce exceptions. You’ll also find that many text editors and IDEs, such as will fight any attempts at shortcuts, automatically closing tags or suggesting there are errors on the page unless you change their preference settings.

您将在此博客的一些代码示例中看到这些快捷方式,以节省空间。 如果您对Web开发不熟悉,我强烈建议您遵循编写HTML代码基本规则 。 (您的网页将继续正常运行,并且代码可能更易于阅读)。 熟悉HTML之后,就可以开始引入例外了。 您还会发现,许多文本编辑器和IDE(例如将与任何尝试使用快捷方式,自动关闭标签或暗示页面上有错误的尝试相 ,除非您更改其首选项设置。

翻译自: https://thenewcode.com/528/HTML5-Shortcuts

html5快捷键

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值