Interview Questions on HTML
31. What are the block level elements?
Block level elements starts with new line and occupies full width(By default).
<div>
<h1> ,<h2>_ _ _ <h6>
<p>
<form>
32. What are all the inline elements?
Inline leements does not start in new line and takes as much width as necessary.
<span>
<a>
<img>
33. What is Difference b/w <div> and <span> elements?
1. <div> :
<div> is a block level element and takes full width by default.
It is used as container to write other HTML elements.
Ex:-
<div style="background-color:black; color:white; padding:20px;">
<h2>London</h2>
<p>London is the capital city of England. It is the most populous city in the United Kingdom, with a metropolitan area of over 13 million inhabitants.</p>
</div>
2. <span> :
<span> is inline elements and take as much width as necessary.
It is used to apply styles for the text.
<h1>My <span style="color:red">Important</span> Heading</h1>
34. Tell me Some of HTML5 elements?
header Defines a header for a document or a section
Nav Defines a container for navigation links
Section Defines a section in a document
Article Defines an independent self-contained article
Aside Defines content aside from the content (like a sidebar)
Footer Defines a footer for a document or a section
Details Defines additional details
summary Defines a heading for the details element
35. What is the use of <iframe>?
<iframe> tag is used to load another web page in current webpage.
Ex:- <iframe src="URL"></iframe>
36. Explain about <form> Element?
<form> is used to collect the user input and pass it to serverpage.
Syn : - <form>
.
form elements
.
</form>
37. What is <input> element?
<input> tag is used to take input from the user.
It can be following types :
1. Text :- take the input as text format
2. Radio :- take input as radio buttons
3. Checkbox :- take input as check box button.
4. Password :- take the input in radio buttons
5. Hidden :- input doesn’t show to the user.
6. Submit :- provides button to submit all inputs.
38. Write sample code for <form> which uses <input> tags?
<form action="action_page.php">
First name:<br>
<input type="text" name="firstname" value="Mickey">
<br>
Last name:<br>
<input type="text" name="lastname" value="Mouse">
<br><br>
<input type="submit" value="Submit">
</form>
39. How to write drop down boxes?
<select>
<option value=”1”> option1 </option>
<option value=”2”> option1 </option>
<option value=”3”> option1 </option>
<option value=”4”> option1 </option>
</select>
40. Explain about <textarea> tag?
Used to take multiline text as input
Ex:-
<textarea name="message" rows="10" cols="30">
</textarea>