HTML and CSS Reference
In-Depth Information
All you are interested in is the character set; hence, the HTML5 spec has been
written to allow this version. You don't need to specify that this is a content-type,
and you don't need to specify the mime-type if you are working with HTML5.
NOTE: Mime-types specify what type of content a file contains
for the benefit of browsers trying to understand what content it
is they are dealing with: in this case, text/html for HTML.
Here you've specified UTF-8, a universal character set that allows all characters
from all languages, or just about. It is best to stick to this character set unless you
have a very good reason not to.
In the HTML5 era there are no longer separate XHTML and HTML DOCTYPEs.
Yo u j u s t u s e t h e s a m e D O C T Y P E , a n d t h e n y o u r e a l l y c a n s t i c k t o w h a t e v e r c o d i n g
style suits you, be it strict XML style or loose HTML style. It is possible to still use
XHTML-style syntax in HTML5 (called XHTML5), as long as you use the correct
mime-type, file extension, and so on. However this creates compatibility problems
with older versions of Internet Explorer (IE), so I wouldn't recommend using it.
In terms of coding style for the topic, I'll use a style first crystallised in my
mind by fellow web education advocate and awesome Swede, Lars Gunther. He
recommends the following guidelines:
Yo u ' l l b e u s i n g H T M L b u t s t i c k i n g t o s o m e X H T M L s y n t a x r u l e s . Yo u ' l l b e
closing all open elements using lowercase for all elements and attributes,
and including quotes around most attribute values.
Yo u d o in ' t in e e d t o w r i t e o u t a t t r i b u t e v a l u e s i in f u l l f o r a t t r i b u t e s w h o s e v a l -
ues are the same as the attribute name—for example <input type=”text”
required> , not <input type=”text” required=”required”> .
Yo u d o n ' t n e e d t o i n c l u d e t r a i l i n g s l a s h e s t o c l o s e e m p t y e l e m e n t s , s o y o u ' l l
use the format <meta charset=”utf-8”> , not <meta charset=”utf-8” /> .
Search WWH ::

Custom Search