HTML Interview Questions and Answers
What is HTML?
Hyper Text Markup Language is known as HTML, and it is the language of the World Wide Web. It is browser understanding language and made up of two things that are content and tags.
What are tags in HTML?
To display content properly in web browser tags are useful in HTML.
Example: <h1>HTML</h1>
What is the difference between HTML and HTML5?
In HTML5 multimedia supported tags are added like we can add audio and video files in our document by using of HTML5. Before versions doesn’t support multimedia tags.
List out some new features in HTML5?
New HMTL5 Input Element Types, Canvas in HTML5, HTML5 Custom Data Attributes
Editable Contents in HTML5
FORMS:
Write syntax of forms in HTML?
<form>
Form elements
</form>
Write syntax for radio button in HTML?
<form>
<input type=”radio” name=”gender” value =”female”> Female <br>
<input type=”radio” name=”gender” value =”male”> Male <br>
</form>
Write syntax for check boxes?
<form>
<input type="checkbox" name="ipad" value=" ipad ">I have ipad <br>
<input type="checkbox" name="laptop" value=" laptop ">I have laptop </br>
</form>
Write syntax for drop down box in HTML?
<form>
<select name="course">
<option value="html">HTML</option>
<option value="java">Java</option>
</select>
</form>
Write syntax for back ground color?
<body background-color="red">//html5
//Focus more on tables
How we can create table in HTML?
<table border="1">
<tr>
<td>Courser name</td>
<td>duration</td>
</tr>
<tr>
<td>java</td>
<td>100days</td>
</tr>
<tr>
<td>html</td>
<td>30days</td>
</tr>
</table>
What is the difference between <tr> and <td>?
In HTML <tr> indicates table rows and <td> indicates table data.
Write a sample code for rowspan?
<table border="1">
<tr>
<th>value1</th>
<th>value2</th>
<th>value3</th>
</tr>
<tr>
<td>10</td>
<td>20</td>
<td rowspan="2">30</td><!-- using rowspan -->
</tr>
<tr>
<td>40</td>
<td>50</td>
</tr>
<tr>
<td>60</td>
<td>70</td>
<td>80</td>
</tr>
</table>
Write a sample code for colspan?
<table border="1">
<tr>
<th>value1</th>
<th>value2</th>
</tr>
<tr>
<td>10</td>
<td>20</td>
</tr>
<tr>
<td>30</td>
<td>40</td>
</tr>
<tr>
<td colspan="2">total is: 60</td><--! colspan using here-->
</tr>
</table>
What is CSS?
What are the differences between internal and inline and external style sheets?
What is the extension of external style sheet?
Cascading style sheets is known as CSS in HTML. To decorate web pages this style sheets are used.
Mainly CSS classified in to three types that are
Inline style sheets
We can apply styles with in a line.
Example:<h1 style="color:red;margin-left:45px;">Html Interview Questions</h1>
Internal style sheets:
This is useful to apply styles with in a single page. The <style></style> tag is used in internal style sheets.
Example:
<html>
<head>
<style>
body {
background-color: yellow;
}
h1 {
color: maroon;
margin-left: 40px;
}
h2 {
color: red;
margin-left: 50px;
}
</style>
</head>
<body>
<h1> heading </h1>
<h2> sub-heading</h2>
</body></html>
External style sheets:
Most recommended style sheets, write all properties in a single file and save that file with .css extension. By using <link> tag link .css file into HTML file.
Example:
body {
background-color: gray;
}
h1 {
color: maroon;
margin-left: 40px;
}
h2 {
color: red;
margin-left: 50px;
}
Save this filestylesheet.css
Link filestylesheet.css file in HTML file.
<html>
<head>
<link rel="stylesheet" type="text/css" href=" stylesheet.css">
</head>
<body>
<h1> heading </h1>
<h2> sub-heading</h2>
</body></html>
What is the difference between <p> and <pre> tag in html?
If we use <p> tag text will continued in a single line.
If we use <pre> tag text displayed in a given order.
Example:
<p>
I am
A
Student
</p>
Output is: I am A Student
<pre>
I am
A
Student
</pre>
But in this case output is:
I am
A
Student(given order output is displayed.)
What is the difference between <div> and <span> tag?
<div>This are block level element and used to group of code.
<div style="color:red">
<p>this is a <em>car </em>color is changed</p>
</div>
<span> inline element and used to single line of code.
Example:
<p>This is a <span style="color:red">car </span>color not effected</p>
What tag is use for to display heading in html h1 or h6?
<h1> tag is used to display headings in a web page.
// h1 to h6 (focus) in interview interviewer may confuse you.
In html all tags have closing tags?
The tags like <img> tag and <br> tag doesn’t have a closing tag.
Which tag is used to display numeric list in web page?
Order list (<ol>) tag is used to display numeric order list in web page.
<ol>
<li>Java</li>
<li>HTML</li>
<li>.Net</li>
</ol>
Which tag is used to display unorder list in web page?
<ul>
<li>Java</li>
<li>HTML</li>
<li>.Net</li>
</ul>
What is the difference between <ol> tag and <ul> tag in HTML?
The <ol> tag is used to display ordered list in web page and by default it stats from
The <ul> tag is used to display unordered list in web page. It represents bullets wise.
What are Empty elements?
Empty elements are not containing any content.
Ex:<br>,<hr>..etc.
What is HTML Quotation Elements?
HTML Quotation Elements are
• <q>
• <blockquote>
<q> is defines short quotation.
<blockquote> is defines markup section quoted from another resource.
What is HTML Phrase Elements?
<em> renders emphasized text.
<strong> defines import text.
<dfn> defines instance term in html.
<code> defines a piece of computer code.
<samp> defines sample output from a computer program.
<kbd> it is used to defines keyboard input.
<var> it is used to defines a variable.
What are HTML input types?
HTML input types are
• text
• password
• Number
• email
• time
• date
• datetime
• month
• file
• url
What is <article> tag and <aside> tag in HTML?
<article> tag is used to display self-contained text.
<aside> tag is used to display the content aside from where it is placed.
(I faced mostly this type of questions in interview so i wrote this...)
1 comments:
Thanks for the interview questions, here is the latest one - AngularJS is a toolset for building the framework most suited to your application development. It is fully extensible and works well with other libraries. Every feature can be modified or replaced to suit your unique development workflow and feature needs.
Read on to find out how:
AngularJS Certification Training in Chennai
EmoticonEmoticon