HTML Interview Question SEVE
HTML Interview Question SEVE
.marq {
padding-top: 30px;
padding-bottom: 30px;
}
.geek1 {
font-size: 36px;
font-weight: bold;
color: white;
padding-bottom: 10px;
}
</style>
</head>
<body>
<div class="main">
<marquee class="marq" bgcolor="Green"
direction="left" loop="">
<div class="geek1">
GeeksforGeeks
</div>
<div class="geek2">
A computer science portal for geeks
</div>
</marquee>
</div>
</body>
</html>
45. Do all the html tags have end tags?
Ans: Most of the HTML tags have a start tag and an end tag. some of the HTML tags doesn't
require for end tag or closed symbol("/").
46. What are the semantic elements?
Ans: Semantic HTML elements are those that clearly describe their meaning in a human- and
machine-readable way. Elements such as <header> , <footer> and <article>
47. What is the difference between block level elements and inline elements?
Ans: Block elements always start from a new line. Inline elements never start from a new
line. Block elements cover space from left to right as far as it can go. Inline elements only
cover the space as bounded by the tags in the HTML element.
48. Give the example of block level elements and inline elements?
<map name="workmap">
<area shape="rect" coords="34,44,270,350" alt="Computer" href="computer.htm">
<area shape="rect" coords="290,172,333,250" alt="Phone" href="phone.htm">
<area shape="circle" coords="337,300,44" alt="Cup of coffee" href="coffee.htm">
</map>
63. Is the <datalist> and <select> tag same?
Ans: <datalist> and <select> tags generally are used for choosing an option from the given
list. But the main difference between both is that in the <datalist> tag the user can enter their
input and add that as an option with the help of the <input> element whereas the <select> tag
doesn’t provide this feature.
<datalist id="courses">
<option value="DSA">
<option value="ML and AI">
</datalist>
<select id="courses">
<option value="Java">Java</option>
<option value="C++">C++</option>
</select>
64. What is the difference between <figure> and <img> tag ?
Ans: The figure tag is used to semantically organize the content of images, videos, audios or
even charts or tables, block of codes in the HTML document. The image tag is used to add
an image to an HTML page. <img> tag can only insert image.
<figure>
<img src="url">
<figcaption>content</figcaption>
</figure>
<img src="url" alt="some_text">
65. Create a nested list in html?
Ans:
<ul>
<li>Coffee</li>
<li>Tea
<ul>
<li>Black tea</li>
<li>Green tea</li>
</ul>
</li>
<li>Milk</li>
</ul>
66. Explain the difference between html and html5?
Ans: HTML5 provides native audio and video support. HTML only supports vector graphics
if used in conjunction with different technologies like Flash, VML, or Silverlight. HTML5
supports SVG (Scalable Vector Graphics), Canvas, and other virtual vector graphics. HTML
allows inline MathML and SVG in text with restricted use.
67. How can you add the css style in an html document?
Ans: CSS is added to HTML pages to format the document according to information in the
style sheet. There are three ways to insert CSS in HTML documents.
1. Inline CSS: Inline CSS Style are included within the HTML document and are specific
or Individual HTML elements are style.
2. Internal CSS: Internal CSS styles are included within the head section of an html
document and apply to the entire document , allowing for constituent styling across
multiple elements.
3. Extenal CSS: External CSS which has least priority and external css file is used to
style one or more multiple web pages.
68. What is the purpose of the required attribute in the <input> tag?
Ans: The HTML Required attribute is a Boolean attribute which specifies that the input
element must be filled out before the submission of form.This attribute used with the
following elements.
1. <input>
We can easily use the required attribute with the <input> element.
Ex: <input required>