In the tutorial of www.bkjia.com, we thought that the width and height of all elements should be controlled by css. As a result, html validator prompts that textarea must have the cols and rows attributes, otherwise it does not comply with W3C XHTML 1.0 Transitional standards.
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <Html xmlns = "http://www.w3.org/1999/xhtml" xml: lang = "yue-Hans" lang = "yue-Hans"> <Head> <Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/> <Title> it works ...... </title> </Head> <Body> <Form action = "./" method = "get"> <Textarea name = "article"> </textarea> </Form> </Body> </Html> |
Error: required attribute "rows" not specified
Error: required attribute "cols" not specified
A little strange, search for this website http://bytes.com/topic/html-css/answers/489646-textarea-cols-rows to explain well.
This involves the idea of HTML: for content-oriented webpages, HTML content should be easy to read when CSS is disabled. If textarea does not have cols and rows, when CSS is disabled, textarea becomes very small and users cannot enter many texts, which does not conform to the semantics of textarea-used to input large text segments.
Therefore, in XHTML 1.0 Transitional, textarea must have the cols and rows attributes.