Enrique Bello Enrique Bello - 2 months ago 8
Vb.net Question

Element 'a' cannot be nested inside element 'iframe'

I am working a WebBowser project in Visual Studio 2015 that embeds a part of their functionality inside another website adding a html file. It runs without warnings using the Run Code snippet of stackoverflow but if I run it in Visual Studio 2015, it runs ok it but I get with these warnings:


  • 200px is not a valid value of attribute width

  • 461px is not a valid value of attribute height

  • Element a cannot be nested inside element iframe



html Code:



<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>




Answer

The width and height attributes do not take units (except %). Therefore:

... width="200" height="461" ...

For the second problem: The error is quite clear. You cannot have an <a> tag within an iframe. You are only allowed to have text inside it. For more details, see here.