Front End Developer (AngularJS) Question:
Download Questions PDF

Explain me what's the difference between HTML and XHTML?


XHTML is an HTML that follows the XML rules, which means a XHTML document must have well-formed markups in order to be rendered properly in all web browsers. Differently from XHTML, the HTML document can be rendered in most of the browsers even with markup errors such as no closing tags or wrong nested tags.

And how do I create a XHTML document?

XHTML is basically a HTML document with some rules that need to be applied. Have a look at these examples below and spot the differences.

<title>This is head</title>
This is the body of the document with body tag in capital letters
Notice that there's no close body tag and no tag as well.
This HTML document above can be opened with no problems in Chrome, even containing many markup errors because most browsers can fix them for you automatically.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

<html xmlns="">
The code above is a well-formed XHTML document and that's the minimum you must have in order to render it. Notice the declaration of the doctype at the top of the document and the namespace (xmlns) attribute in html open tag. These elements are mandatory as well as all the tags in lowercase.

Download Front End Developer (AngularJS) Interview Questions And Answers PDF

Previous QuestionNext Question
Tell me have you ever used an MVC? Which one and what do you like and dislike about it?Tell me in CoffeeScript how clone-function is useful?