简体   繁体   English

&在HTML属性中有效吗?

[英]& is valid in an HTML attribute?

While writing a series of music options, he called me to attention as Atom expected me to close with a ; 在编写一系列音乐选项时,他引起了我的注意,因为Atom希望我以“;”结束。 after putting a & in the value section. 在值部分添加&之后。

<option value="R&amp;B/Soul">R&amp;B/Soul</option>
<option value="R&B/Soul">R&amp;B/Soul</option>

Is the first line correct, or is it just an atom error? 第一行是正确的还是仅仅是原子错误?

Yes, it's correct. 是的,这是正确的。 1 It's pretty clear that you did in fact terminate the character reference with a ; 1很显然,您实际上确实以;终止了字符引用。 in the right spot, so I don't know why Atom is complaining. 在正确的位置,所以我不知道为什么Atom在抱怨。


1 In fact, both lines are valid , even if the latter is incredibly bad practice. 1 实际上, 这两行都是有效的 ,即使后者是非常糟糕的做法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM