2015-02-18 86 views
-2

出于某种原因,我得到一个错误,指出:“元素风格不允许作为元素形式的孩子”

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

你做错了什么是把<style>标签放在错误的地方。将所有<style>声明放入文档的<head>部分。根据the HTML5 specification,这是它必须去的地方。

+0

谢谢。这工作。您是否是HTML5的真正专家?如果是的话,我应该去哪里了解更多。我正在尝试创建一个网站,并不确定如何将css页面链接到HTML页面。 – 2015-02-21 02:38:50

+0

@DeQuanLynch - Mozilla网站[适用于开发人员的网络技术](https://developer.mozilla.org/en-US/docs/Web)是一个很好的开始。 – 2015-02-22 04:43:30

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>元件。

+0

非常感谢,这解决了我的问题。如此单一的东西可能会让一个人疯狂。 – 2015-02-21 02:39:19

相关问题