Jump to content

There are rules?


davej
 Share

Recommended Posts

Saw this question posted to Yahoo...

List the six basic rules needed to create syntactically correct HTML5 codeand briefly describe each one.

http://answers.yahoo...&paid=add_watch So what could these six rules possibly be? Close your tags? Use lower-case? Begin with a DOCTYPE? Use the W3C validator?

Edited by davej
Link to comment
Share on other sites

There's nothing in the official specification about six rules, just definitions on how tags, attributes, comments and text nodes are written. HTML doesn't require lowercase tags, nor does it require closing certain elements.

Link to comment
Share on other sites

It looks to me as if someone had an HTML class, where the teacher had their own "six rules" that they deem most critical. So rather than writing these rules down, the person asked at Yahoo! Answers what these rules were, hoping they're universal, and that therefore, people will know the answer.

Link to comment
Share on other sites

It looks to me as if someone had an HTML class, where the teacher had their own "six rules" that they deem most critical. So rather than writing these rules down, the person asked at Yahoo! Answers what these rules were, hoping they're universal, and that therefore, people will know the answer.
Yes, and I'm just curious what they might be. Can you formulate some nice rules?
Link to comment
Share on other sites

Well... OK... but again, it's important to note my six rules may not be that teacher's six rules.1. Add an appropriate DTD.2. Nest appropriately, i.e. instead of stuff like

<p><b>Bold <i>bold and italic</b> italic</i></p>

use

<p><b>Bold <i>bold and italic</i></b><i> italic</i></p>

3. Close empty tags in accordance to the chosen DTD, e.g. if you're using an HTML DTD, use

<br>

and if you're using an X(HT)ML DTD, use

<br />

4. At ALL times you want to write "&", use "&" instead. Don't forget the "&" in "src" and "href" attributes.5. Always specify an "alt" attribute on images, even if it's an empty one.6. Always specify the charset of your document with an appropriate meta tag at the head (ideally, use and specify "UTF-8").

Link to comment
Share on other sites

also, if you use Chrome to develop like I do, they have a simple plugin to do validation that can check your code as develop/refresh.https://chrome.google.com/webstore/detail/html-validator/cgndfbhngibokieehnjhbjkkhbfmhojo?hl=en

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...