How to write basic HTML5 page
HTML5 page: This is the most basic question any interview can ask you if you are fresher and apply for UI developer job as fresher.
How to write basic HTML5 page ?
Write sample HTML5 page ?
You just copy below HTML5 page code and paste in notepad or notepad++ or any code editor, save the file with .html extension and open the file any web browser to see the output.
<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <!-- You can update below code to show in the web page --> <h1>This is a Heading</h1> <p>This is a paragraph.</p> </body> </html>
The most important thing you need to remember is <!DOCTYPE html> tag. You may get the questions like:
why we use DOCTYPE?
if we don’t use DOCTYPE then what happen?
How browser understand this is web page have the HTML code ?
A <!DOCTYPE> or document type declaration is an instruction which tells the web browser about the markup language in which the current page is written. The <!DOCTYPE> is not an element or tag, it lets the browser know about the version of or standard of HTML or any other markup language that is being used in the document.
Older HTML Documents
In older documents (HTML 4 or XHTML), the declaration is more complicated because the declaration must refer to a DTD (Document Type Definition).
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE> declaration is NOT case sensitive.
<!DOCTYPE html> <!DocType html> <!Doctype html> <!doctype html>