HTML属性使用单引号是正确的吗? [英] Is it correct to use single quotes for HTML attributes?

查看:478
本文介绍了HTML属性使用单引号是正确的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我看到很多这样的:

Recently I've been seeing a lot of this:

<a href='http://widget-site-example.com/example.html'>
    <img src='http://widget-site-example.com/ross.jpg' alt='Ross&#39;s Widget' />
</a>

在HTML中使用单引号有效吗?

Is it valid to use single quotes in HTML? As I've highlighted above it's also problematic because you have to escape apostrophes.

推荐答案

使用单引号确实有效(< a href =http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2 =nofollow noreferrer> HTML 4.01,第3.2.2节)。我没有注意到这样的趋势,但也许有一些框架,强大的网站,你访问过,使用单引号报价。

It's certainly valid to use single quotes (HTML 4.01, section 3.2.2). I haven't noticed such a trend, but perhaps there's some framework that powers web sites you've visited that happens to quote using single quotes.

这篇关于HTML属性使用单引号是正确的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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