HTML中的文本区域显示代码而不是呈现和格式化

时间:2013-04-18 05:17:02

标签: html css

我之前做过textareas,但这只是杀了我。文本区域显示html代码,并且没有正确css。所以在实际的窗口中我得到了textarea元素的代码,它也显示了我的其余代码,而不是渲染它。如果没有textarea标签,一切都会发挥作用。

<article>
<form method="POST" name="form9" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <label for="firstName">First Name <sup>*</sup></label>
    <input type="text" id="firstName" name="firstName" required />

    <label for="lastName">Last Name <sup>*</sup></label>
    <input type="text" id="lastName" name="lastName"/>

    <label for="wrstyle">Writing Style <sup>*</sup></label>
    <textarea placeholder="Please, briefly describe your writing style." type="text" id="wrstyle" name="wrstyle"</textarea>

    <label for="submit" class="centerit" title="Click here to register your account">
    <input type="submit" name="submit" value="Sign Up" />
                </label>
                <p class="notice"><sup>*</sup> denotes a required field.</p>

</form>
</article>

2 个答案:

答案 0 :(得分:2)

您不会关闭textarea的开头标记(您缺少>):

http://jsfiddle.net/Bvk92/

值得注意的是<textarea> has no type attribute.

答案 1 :(得分:0)

你忘了关闭文字区域的标签.......

 <article>
    <form method="POST" name="form9" action="<?php echo $_SERVER['PHP_SELF']; ?>">
        <label for="firstName">First Name <sup>*</sup></label>
        <input type="text" id="firstName" name="firstName" required />

        <label for="lastName">Last Name <sup>*</sup></label>
        <input type="text" id="lastName" name="lastName"/>

        <label for="wrstyle">Writing Style <sup>*</sup></label>
        <textarea placeholder="Please, briefly describe your writing style." type="text" id="wrstyle" name="wrstyle"></textarea>

        <label for="submit" class="centerit" title="Click here to register your account">
        <input type="submit" name="submit" value="Sign Up" />
                    </label>
                    <p class="notice"><sup>*</sup> denotes a required field.</p>

    </form>
    </article>