Here you can learn HTML CSS JavaScript interview questions. in most of the interviews asking some this type of basic and unique questions about html css and javascript.
1) What is HTML ?
Answer : HTML stands for HyperText Markup Language. It is the standard markup language used to create web pages.
2) What is the difference between <div> and <span>?
Answer : <div> tag is a block-level element. It is used for group content, while <span> tag is an inline element used to style a small part of the content.
3) What is CSS ?
Answer : CSS stands for Cascading Style Sheets.it is a style sheet language used to giving the style into the HTML elements.
4) Explain the CSS box model.
Answer : The CSS box model consists of margins, borders, padding, and the content area that determine the layout of elements on a page.
5) What is JavaScript?
Answer : JavaScript is a scripting language use to create dynamic and interactive content on web pages.
6) What is the difference between var, let, and const in JavaScript?
Answer : var has function scope, while let and const have block scope. const is used for variables that assign only for one time.
7) What are meta tags in HTML?
Answer : The Meta tags place into the <head> tag.it is provide metadata about the HTML document, such as author and description.
8) Explain the purpose of alt attribute in images.
Answer : The alt attribute is a alternative text for an image. If image failed to load so alternative text appear on the image section and show about image.
9) How can you center a div horizontally in CSS?
Answer : Using margin: 0 auto; and setting a width for the div.
10) What are CSS selectors ?
Answer : CSS selectors used to select elements to apply styles.
For Examples : if include class selector so apply (.classname) For ID selectors apply (#id) and element selector apply (elementname).
11) What is the DOM?
Answer : The DOM stands for document object model. It is allows javascript to interact and manipulate the structure, style and content of a html elements in webpages.
12) How do you create an object in JavaScript?
Answer : By using object literal syntax: let obj = { key: value };, or by using the new keyword with a constructor function.
13) What is the difference between HTML5 and HTML?
Answer : HTML5 introduced in new semantic tags, multimedia elements like <audio>, <video>, APIs and a more flexible document structure.
14) How do you create a hyperlink in HTML?
Answer : Using the <a> tag create hyperlink in HTML. <a href=”url”>Text About Link</a>.
15) What is a media query in CSS?
Answer : A media query allows to make responsive design for different size device. For example mobile, tablets and windows etc.
16) What are pseudo-classes in CSS?
Answer : Pseudo-classes allow you to style an element in a special state, such as :hover, :active, or :focus.
17) What is the this keyword in javascript ?
Answer : In JavaScript this keyword refers to the object that is currently executing a function. Its value depends on the context in which the function is called.
const obj = {
name: “PDTech”,
showThis: function() {
console.log(this); // Refers to obj
}
};
obj.showThis(); // Logs obj
18) Explain the difference between == and === in JavaScript.
Answer : 1 == ‘1’; // true, because ‘1’ (string) is coerced to 1 (number)
true == 1; // true, because true is coerced to 1
false == 0; // true, because false is coerced to 0
null == undefined; // true, special case in JavaScript.
19) What is the DOCTYPE in HTML?
Answer : The DOCTYPE declaration defines the HTML version. and helps browsers to render the page correctly.
20) What is the purpose of the <head> tag?
Answer : The <head> tag contains metadata, links to stylesheets, scripts, and other important information that does not display on the page.
Here above some essentials HTML CSS and JavaScript Interview Questions.
Top 10 Java Coding Interview Questions
Top 10 Artificial Intelligence (AI) Interview Questions and Answers