HTML 5 Interview Questions and Answers Part 1

1. Does doctype is case sensitive in html?
Ans. It is not case sensitive. Both "<!DOCTYPE HTML>" and "<!doctype html>" are same.


2. How do we declare language in html tag?
Ans. Language is defined using "lang" attribute in html tag.
example : <html lang="en-US">


3. How to add tooltip to element with attribute in html?
Ans. "Title" attribute is used show tooltip in html.
example : <span title="Dotnet Queries">Welcome to  
dotnetqueries </span>


4. What is the output of this following tag <p title=dotnet queries> Freshers & Experienced .Net Interview Questions </p>
Ans. Since html5 supports attribute values without quotes but still it is recommended
because it will not display correctly when used with spaces in between words as value.


Example :
span title=Dotnet Queries>Welcome to 
dotnetqueries </span>
Output : only "Dotnet" will be displayed


5. What is the output of this following tag,<p title="dot "net" queries"> Freshers & Experienced .Net Interview Questions </p>
Ans. Here, to show title with quotes we need to use combination of single and double quotes. But if we use double quotes alone only first word will be displayed.
Here in this case "dot" word will be displayed.Right way to show is, 
<p title="dot 'net' queries"> Freshers & Experienced .Net Interview Questions </p>
  (or)
<p title='dot "net" queries'> Freshers & Experienced .Net Interview Questions </p>


6. What will browser do when it sees paragraph tag <p> in html page?
Ans. It will automatically add an empty line before and after a paragraph.

7. What will be the output of the following tags,
<p>
This is first paragraph after which there are two line breaks.
</p>

<p>
This is second       paragraph
with     spaces  in between  words.
</p>

Ans. Since html output format is not known in prior.  But the browser will treat any number of spaces and new line breaks as single space.
The output would be like this,

This is first paragraph after which there are two line breaks.


This is second paragraph with spaces in between words.

8. How to preserve the spaces and new lines in html page?
Ans. "<pre>" tag is used to preserve the spaces and new lines in html page.

Example :

<pre>
This is second       paragraph

with     spaces  in between  words and  line breaks.
</pre>

Output :

This is second       paragraph

with     spaces  in between  words and  line breaks.






Subscribe

Receive Quality Tutorials Straight in your Inbox by submitting your Email below:

Delivered by FeedBurner

Protected by Copyscape Duplicate Content Checker