Enrique Bello Enrique Bello - 1 year ago 81
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:

<title>Stock Quotes</title>
<style type="text/css">
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: Gray;
<iframe align="top" allowtransparency="true" marginwidth="0"
marginheight="0" hspace="0" vspace="0" frameborder="0"
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>

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download