在我根本无法弄清楚的关于迷路开始标签的错误中 [英] Getting error about a stray start tag that I simply can't figure out

查看:54
本文介绍了在我根本无法弄清楚的关于迷路开始标签的错误中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

底部有一个

我有此代码:

<select name="archive-dropdown" onchange="document.location.href=this.options[this.selectedIndex].value;">
    <option value="">Select Month</option> 
    <option value='http://www.example.com?m=201512'>
    <span style="text-decoration: underline; color: blue;">
        December 2015 &nbsp;(4)
    </span>
    </option>
</select>

当我用Firebug检查HTML时,没有span标签.如果我通过Firefox查看页面源,则span开始标记和结束标记以红色显示,表明有问题.

When I inspect the HTML with Firebug, the span tag is not there. If I look at the page source, via Firefox, the span start tag and end tag are displayed in red indicating that something is wrong.

将光标悬停在红色代码上方,会给我:流浪开始标签"span"

Hovering the cursor over the red code gives me: Stray start tag "span"

如果我通过验证程序运行页面,则不会发现错误.

If I run the page through a validator, no errors are found.

也许选项标签中不允许使用span标签?

Perhaps a span tag is not allowed in a option tag???

但是,为什么验证器不标记它呢?

But then, why doesn't the validator not flag it???

编辑* * * * 关于验证器的信息,我再次看了一眼,发现我正在使用CSS验证器.

EDIT * * * * NIX THE BIT ABOUT THE VALIDATOR, I just looked again and found I was using the CSS validator.

我通过标记验证程序运行页面并得到:

I ran the page through the markup vaidator and got:

错误:杂散起始标签跨度.

Error: Stray start tag span.

从273行的第80列开始;到第273行第134列

From line 273, column 80; to line 273, column 134

m = 201512'>< span style ="text-decoration:下划线;颜色: 蓝色;> Decem

m=201512'><span style="text-decoration: underline; color: blue;"> Decem

有什么想法吗?

推荐答案

MDN选项:

允许的内容带有最终转义字符(例如é)的文本.

Permitted content Text with eventually escaped characters (like é).

不允许跨度,只能是文本.如果要设置文本样式,则需要查看不是标准元素的JavaScript/CSS解决方案.

No spans are permitted, it is text only. If you want to style the text, you need to look at a JavaScript/CSS solution that is not a standard element.

http://www.w3.org/TR/html5/forms.html#the-option-element

这篇关于在我根本无法弄清楚的关于迷路开始标签的错误中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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