2015-02-18 87 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

相關問題