HTML 5 - What's changed in HTML 5? Doctype and simplicity!
HTML 5 is definitely going to make our lives easier as web developers. Here are some of the biggest changes coming to HTML 5 that you'll notice (not all of which is listed here - feel free to respond with any further HTML 5 spec.)
HTML 5 doctype declaration
Right now, to declare the doctype is nothing short of long and confusing, and it could be much, much simpler. Luckily, the W3C has agreed. In HTML 5, the doctype is incredibly simple:
Old:
Code:
1.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
New:
The doctype is necessary to ensure compatibility with browsers that require a doctype declaration. However, when HTML 5 is in full swing, it won't be necessary.
The type attribute in script and style HTML tags
You no longer need to specify the type of the script or style tag. By default, the browser should assume it is a JavaScript or CSS stylesheet, respectively. This is implied unless explicitly stated otherwise by the use of the type tag atttribute.
New "e-mail" text field
In HTML 5, you will have some form of client-side validation by the use of amn email text field type. The browser will do client-side validation that can safe time on the server-side, as most people will not bypass the client-side validation checks. However, that said, it is still important to do server-side checks; it's easy to bypass any kind of client-side validation checks, including JavaScript checks. It's merely more for end-user convenience than anything else.
Code:
<input type="email" name="email">
"Pattern" attribute in text fields
You can now do client-side regular expression checks. If you're familar with the use of regular expressions in programming languages like Perl and PHP, you'll feel right at home with the pattern attribute of the input tag. It can safe processing time on the server-side as a lot of the checks will be conducted on the client-side. Again, always still do server-side checks to be absolutely safe. It would be a rookie mistake to simply trust client-side validation checks - they can be bypassed very easily.
Code:
<input type="text" name="username" pattern="[a-zA-Z]{3,25}">
This requires that a username be at least 3 characters long and no more than 25 - again, a client-side validation check.
Regards,
[url=http://b3ns.com]Ben Stones[/url]
Need to contact us?
Support - 0808 262 0606 or [URL="http://support.webhosting.uk.com"]
support.webhosting.uk.com[/URL]
Customer Relations - 0808 262 0855 or [URL="http://support.webhosting.uk.com"]
support.webhosting.uk.com[/URL]
Sales - 0800 862 0890 or [email]sales@webhosting.uk.com[/email]
Contact
[email]ben@webhosting.uk.com[/email]
Skype ID: whuk_ben
Bookmarks