Most asked HTML interview questions?
- right now i am preparing for a full stack role in India, and you know right people love to ask questions in the interview rather than the actual experience based questions, so today we will gather the list of interview questions for HTML
- What are Tags and Attributes in HTML ?
Answer : Tags are the primary component of the HTML language that defines how the content should be structured. The attributes are the property that are used along with the element
Ex :
<p align="center" > This is paragraph</p>
here <p> </p>
is the tag and the attribute is the align with value as center which will center the content of the paragraph.
- What are void Elements in HTML ?
Answer : Element that does not require the closing tag are called as void elements such as
<br/> <hr/> <img / >
- What are the different type of lists in HTML ?
There are two different type of lists in HTML that is ordered and unordered list.
- Ordered List :
<ol>
<li>first item</li>
<li>second item</li>
</ol>
<ul>
<li>first item</li>
<li>second item</li>
</ul>
- What is the ‘class’ attribute in HTML?
Answer : Class attribute in HTML is used to give the class name to the HTML elements and it will be used when we want to give the same style to number of elements, lets say, we have 10 heading in a complete HTML page and we want the same style to be applied to all the elements in that case we can give the class all the heading and then apply css to all the heading .
in the below mentioned screenshot all the 5 heading have the same class and we have added the CSS for that particular class.
<h5 class="heading-style">This is the first heading</h5>
<h5 class="heading-style">This is the first heading</h5>
<h5 class="heading-style">This is the first heading</h5>
<h5 class="heading-style">This is the first heading</h5>
<h5 class="heading-style">This is the first heading</h5>
- What is the difference between the ‘id’ attribute and the ‘class’ attribute of HTML elements?
Answer. id attribute should be unique and class attribute can be used multiple times with different elements however there won't be any error if you use the id attribute multiple times, there will be consequences when you are using document.getElementById("#first-id") in this case you might run into problems.
- Describe the HTML layout structure?
Answer :
- How to optimize the website asset loading ?
How to improve the load performance ? This is the tutorial from google, about how we can improve the performance of the website
First we need to open the website in the incognito mode to avoid any hindrance by the extension then we need to audit our website and then based on the suggestions we can work on improving the performance of the website.
youtube.com/watch?v=5fLW5Q5ODiE
follow the above mentioned tutorial to understand it completely,