出于某种原因,我收到的错误是:
在此上下文中,元素
style
不允许作为元素form
的子元素。 (抑制此子树中的更多错误。)行:17
这是我的代码:
<!DOCTYPE HTML>
<html lang="en-US"><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
<form method="post" spellcheck="true" action="http://www.ijdky.net">
<input name="text" class="name" placeholder="Please Enter Name">
<!-- This Part is Where the user will type their name for the comment section-->
<br> <!-- Break -->
<br> <!-- Break -->
<style type="text/css"> textarea.html-text-box {background-color:white;background-repeat:no-repeat;background-attachment:fixed;border-width:4;border-style:solid;border-color:black;font-family:Georgia;font-size:16pt;color:black;}
input.html-text-box {background-color:ffffff;font-family:Georgia;font-size:12pt;color:000000;}
</style> <!-- The Comment Box -->
<textarea name="comments" cols="40" rows="10" class="html-text-box"> </textarea>
<br> <!-- Break -->
<br> <!-- Break -->
<input type="submit" value="Submit Comment" class="html-text-box">
<br> <!-- Break -->
<br> <!-- Break -->
<input type="reset" value="Reset Comment" class="html-text-box">
</form>
</body>
</html
<!-- begin snippet: js hide: false -->
<!-- language: lang-html -->
<!DOCTYPE HTML>
<html lang="en-US"><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
<form method="post" spellcheck="true" action="http://www.ijdky.net">
<input name="text" class="name" placeholder="Please Enter Name">
<!-- This Part is Where the user will type their name for the comment section-->
<br> <!-- Break -->
<br> <!-- Break -->
<style type="text/css"> textarea.html-text-box {background-color:white;background-repeat:no-repeat;background-attachment:fixed;border-width:4;border-style:solid;border-color:black;font-family:Georgia;font-size:16pt;color:black;}
input.html-text-box {background-color:ffffff;font-family:Georgia;font-size:12pt;color:000000;}
</style> <!-- The Comment Box -->
<textarea name="comments" cols="40" rows="10" class="html-text-box"></textarea>
<br> <!-- Break -->
<br> <!-- Break -->
<input type="submit" value="Submit Comment" class="html-text-box">
<br> <!-- Break -->
<br> <!-- Break -->
<input type="reset" value="Reset Comment" class="html-text-box">
</form>
</body>
</html>
我到处搜寻,找不到任何东西。
答案 0 :(得分:1)
移动它:
<style type="text/css"> textarea.html-text-box {background-color:white;background-repeat:no-repeat;background-attachment:fixed;border-width:4;border-style:solid;border-color:black;font-family:Georgia;font-size:16pt;color:black;}
input.html-text-box {background-color:ffffff;font-family:Georgia;font-size:12pt;color:000000;}
</style>
到<head>
元素。
答案 1 :(得分:0)
你做错了是将<style>
标记放在错误的位置。将所有<style>
声明放在文档的<head>
部分中。根据{{3}},这就是它必须去的地方。