元素 'a' 不能嵌套在元素 'iframe' 中
Element 'a' cannot be nested inside element 'iframe'
我在 Visual Studio 2015 年从事一个 WebBowser 项目,该项目将其部分功能嵌入另一个网站并添加 html 文件。它 运行s 使用 Whosebug 的 运行 代码片段没有警告,但如果我 运行 它在 Visual Studio 2015,它 运行s 没问题,但我得到了这些警告:
- 200px 不是属性宽度的有效值
- 461px 不是属性高度的有效值
- 元素 a 不能嵌套在元素 iframe 中
html代码:
<html>
<head>
<title>Stock Quotes</title>
<style type="text/css">
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: Gray;
}
</style>
</head>
<body>
<iframe align="top" allowtransparency="true" marginwidth="0"
marginheight="0" hspace="0" vspace="0" frameborder="0"
scrolling="no"
src="http://api.finance.yahoo.com/instrument/1.0/GOOG,MSFT,ORCL,IBM/badge;quote/HTML?AppID=IEw2Pos2SwyGn532s_VbTecq4mIL&sig=BPVwexNv5yP8zim6MxBootdHqJw-&t=1256412813067"
width="200px" height="461px">
<a href="http://finance.yahoo.com">Yahoo! Finance</a>
<a href="http://finance.yahoo.com/q?s=GOOG">Quote for GOOG</a>
</iframe>
</body>
</html>
width
和height
属性不带单位(%
除外)。因此:
... width="200" height="461" ...
对于第二个问题:错误已经很明显了。 iframe 中不能有 <a>
标记。您只能在其中包含文本。有关详细信息,请参阅 here。
我在 Visual Studio 2015 年从事一个 WebBowser 项目,该项目将其部分功能嵌入另一个网站并添加 html 文件。它 运行s 使用 Whosebug 的 运行 代码片段没有警告,但如果我 运行 它在 Visual Studio 2015,它 运行s 没问题,但我得到了这些警告:
- 200px 不是属性宽度的有效值
- 461px 不是属性高度的有效值
- 元素 a 不能嵌套在元素 iframe 中
html代码:
<html>
<head>
<title>Stock Quotes</title>
<style type="text/css">
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: Gray;
}
</style>
</head>
<body>
<iframe align="top" allowtransparency="true" marginwidth="0"
marginheight="0" hspace="0" vspace="0" frameborder="0"
scrolling="no"
src="http://api.finance.yahoo.com/instrument/1.0/GOOG,MSFT,ORCL,IBM/badge;quote/HTML?AppID=IEw2Pos2SwyGn532s_VbTecq4mIL&sig=BPVwexNv5yP8zim6MxBootdHqJw-&t=1256412813067"
width="200px" height="461px">
<a href="http://finance.yahoo.com">Yahoo! Finance</a>
<a href="http://finance.yahoo.com/q?s=GOOG">Quote for GOOG</a>
</iframe>
</body>
</html>
width
和height
属性不带单位(%
除外)。因此:
... width="200" height="461" ...
对于第二个问题:错误已经很明显了。 iframe 中不能有 <a>
标记。您只能在其中包含文本。有关详细信息,请参阅 here。