HTML CSS interview questions by Aman Khan_533f7e18-33f3-4dbb-94c1-1aa879fb9039
HTML CSS interview questions by Aman Khan_533f7e18-33f3-4dbb-94c1-1aa879fb9039
05, Shayam Plaza, Patwardhan marg, Just behind Grace Church, Dewas, M.P. 455001
By Aman Khan 1
HTML, CSS & BOOTSTRAP INTERVIEW QUESTIONS WITH ANSWERS
1. What is HTML?
a. HTML stands for Hypertext Markup Language. It is the standard markup language
used for defining web structure.
By Aman Khan 2
HTML, CSS & BOOTSTRAP INTERVIEW QUESTIONS WITH ANSWERS
11. What is the purpose of the href attribute in the <a> tag?
a. The href attribute specifies the URL or destination of the hyperlink.
13. What is the purpose of the src attribute in the <img> tag?
a. The src attribute specifies the source file or URL of the image.
15. What are the <thead>, <tbody>, and <tfoot> tags used for in HTML5?
a. The <thead> tag is used to group the header content in a table. The <tbody> tag is
used to group the body content, and the <tfoot> tag is used to group the footer content.
By Aman Khan 3
HTML, CSS & BOOTSTRAP INTERVIEW QUESTIONS WITH ANSWERS
17. What is the purpose of the <th> and <td> tags in HTML?
a. The <th> tag is used to define a header cell in a table, while the <td> tag is used to
define a data cell.
18. What is the purpose of the colspan and rowspan attributes in the <td> and <th>
tags?
a. The colspan attribute specifies the number of columns a cell should span, and the
rowspan attribute specifies the number of rows a cell should span.
22. What is the purpose of the method attribute in the <form> tag?
a. The method attribute specifies the HTTP method used to send form data to the
server. The most common values are "GET" and "POST".
By Aman Khan 4
HTML, CSS & BOOTSTRAP INTERVIEW QUESTIONS WITH ANSWERS
23. What is the purpose of the action attribute in the <form> tag?
a. The action attribute specifies the URL or destination where the form data should be
sent.
25. What is the purpose of the type attribute in the <input> tag?
a. The type attribute specifies the type of input field to be created, such as "text",
"checkbox", "radio", "submit", etc.
28. What is the purpose of the <option> tag in the <select> tag?
a. The <option> tag is used to define an option within a dropdown list.
29. What is the purpose of the value attribute in the <option> tag?
a. The value attribute specifies the value associated with an option. It is sent to the
server when the form is submitted.
By Aman Khan 5
HTML, CSS & BOOTSTRAP INTERVIEW QUESTIONS WITH ANSWERS
33. What is the purpose of the <audio> and <video> tags in HTML5?
a. The <audio> tag is used to embed audio content on a web page, and the <video>
tag is used to embed video content. They provide built-in controls for playing and
pausing the media.
34. What is the purpose of the <header>, <main>, <footer>, and <nav> tags in
HTML5?
a. The <header> tag is used to define the header section of a web page. The <main>
tag is used to define the main content area. The <footer> tag is used to define the footer
section, and the <nav> tag is used to define the navigation section.
35. What is the purpose of the <article> and <section> tags in HTML5?
a. The <article> tag is used to define an independent, self-contained content section
that can be distributed and reused. The <section> tag is used to define a section of
related content within an HTML document.
By Aman Khan 6
HTML, CSS & BOOTSTRAP INTERVIEW QUESTIONS WITH ANSWERS
By Aman Khan 7
HTML, CSS & BOOTSTRAP INTERVIEW QUESTIONS WITH ANSWERS
48. What is the purpose of the alt attribute in the <img> tag?
a. The alt attribute is used to provide alternative text for an image. It is displayed if
the image cannot be loaded or for accessibility purposes.
50. What is the purpose of the download attribute in the <a> tag?
The download attribute is used to specify that a hyperlink should be downloaded
instead of navigated to when clicked. It specifies the filename of the downloaded file.
By Aman Khan 8
HTML, CSS & BOOTSTRAP INTERVIEW QUESTIONS WITH ANSWERS
By Aman Khan 9
HTML, CSS & BOOTSTRAP INTERVIEW QUESTIONS WITH ANSWERS
The top new features in HTML5 are the introduction of audio and video tags, vector
graphics options, figure and figcaption tags to not only markup an image but also allot
space for its caption in the document. All these improvements make the syntax of
HTML5 much simpler and user-friendly as compared to HTML4.
HSL: HSL stands for Hue, Saturation, and Lightness respectively. This format uses the
cylindrical coordinate system.
Hue: Hue is the degree of the color wheel. Its value lies between 0 to 360 where
0 represents red, 120 represents green and 240 represents a blue color.
By Aman Khan 10
HTML, CSS & BOOTSTRAP INTERVIEW QUESTIONS WITH ANSWERS
Margin is used to create space around elements and padding is used to create
space around elements inside the border.
We can set the margin property to auto but we cannot set the padding property
to auto.
By Aman Khan 11
HTML, CSS & BOOTSTRAP INTERVIEW QUESTIONS WITH ANSWERS
CSS border properties allow us to set the style, color, and width of the border.
CSS outline property allows us to draw a line around the element, outside the
border.
The CSS box model is a container that contains multiple properties including borders,
margin, padding, and the content itself. It is used to create the design and layout of web
pages.
By Aman Khan 12
HTML, CSS & BOOTSTRAP INTERVIEW QUESTIONS WITH ANSWERS
The position property in CSS tells about the method of positioning for an element or an
HTML entity. There are five different types of position properties available in CSS:
1. Fixed
2. Static
3. Relative
4. Absolute
5. Sticky
The CSS overflow controls the big content. It tells whether to clip content or to add scroll
bars. The overflow contains the following property:
visible
hidden
scroll
auto
By Aman Khan 13
HTML, CSS & BOOTSTRAP INTERVIEW QUESTIONS WITH ANSWERS
Links can exist in different states and they can be styled using pseudo-classes.
There are four states of links given below:
73. What is the difference between display: none and visibility: hidden?
Both of the property is quite useful in CSS. the difference between display:
“none”; and visibility: “hidden”;, right from the name itself we can tell the difference
as display: “none”, completely gets rids of the tag, as it had never existed in the HTML
page whereas visibility: “hidden”;, just makes the tag invisible it will still be on the
HTML page occupying space it’s just invisible.
The CSS overflow controls the big content. It tells whether to clip content or to add scroll
bars. The overflow contains the following property:
visible
hidden
scroll
auto
Media query is used to create a responsive web design. It means that the view of a web
page differs from system to system based on screen or media types
By Aman Khan 14
HTML, CSS & BOOTSTRAP INTERVIEW QUESTIONS WITH ANSWERS
The CSS Attribute Selector is used to select an element with some specific attribute or
attribute value.
There are several types of attribute selectors which are discussed below:
[attribute] Selector: This type of attribute selector is used to select all the
elements that have the specified attribute and applies the CSS property to that
attribute. For example, the selector [class] will select all the elements with the
style attribute.
[attribute = “value”] Selector: This selector is used to select all the elements
whose attribute has the value exactly the same as the specified value.
Bootstrap is a free and open-source tool collection used for creating responsive websites
and web applications. It is the most popular HTML, CSS, and JavaScript framework for
developing responsive, mobile-first websites. Bootstrap is used for creating tables,
forms, buttons, carousels, navigation bars, and images.
By adding the class .img-responsive to the <img> tag in Bootstrap, images may be made
responsive. This class gives the picture max-width: 100%; and height: auto; so that it
scales well with the parent element.
By Aman Khan 15
HTML, CSS & BOOTSTRAP INTERVIEW QUESTIONS WITH ANSWERS
Bootstrap Grid System divides up to 12 columns across the page. You can use each of
them individually or also can be merge together for wider columns. You can use 12
columns each of width 1 or use 4 columns each of width 3 or any other combination.
Ordered Lists: In Ordered lists items are marked with numerical bullets such as
1,2, i, ii, etc.
Definition Lists: In Definition lists, items are defined with their description.
Bootstrap 4 has 5 levels (xs, sm, md, lg, xl). And Bootsstrap 5 has 6 levels (xs, sm,
md, lg, xl, xxl).
Bootstrap 4 has jquery and all related plugins. But in Bootstrap 5, jquery is
removed and switched to vanilla JS with some working plugins.
Bootstrap 4 doesn’t have its own SVG icons, we have to use font-awesome for
icons. Whereas Bootstrap 5 has its own SVG icons.
By Aman Khan 16
HTML, CSS & BOOTSTRAP INTERVIEW QUESTIONS WITH ANSWERS
84. Explain what is list group in Bootstrap and what is the use of it?
List Groups are used to display a series of content. We can modify them to support any
content as per our needs. The use of List-Groups is just to display a series or list of
content in an organized way.
HTML5 introduced 5 most popular media element tags that are supported by the
browsers, which are described below:
<audio>: It is an inline element that is used to embed sound files into a web page.
<video>: It is used to embed video files into a web page.
<source>: It is used to attach multimedia files like audio, video, and pictures.
<embed>: It is used for embedding external applications which are generally
multimedia content like audio or video into an HTML document.
<track>: It specifies text tracks for media components audio and video.
A universal selector is a selector that matches any element type's name instead of
selecting elements of a particular type.
Example:
*{
color: blue;
font-size: 10px;
By Aman Khan 17
HTML, CSS & BOOTSTRAP INTERVIEW QUESTIONS WITH ANSWERS
The CSS box model defines the layout and design of CSS elements. The elements are
content (like text and images, padding (the area around content), border (the area
around padding), and margin (the area around the border).
The main difference between CSS3 and CSS2 is that CSS divides different sections into
modules and supports many browsers. It also contains new General Sibling Combinators
responsible for matching similar elements.
RGB represents colors in CSS. The three streams are namely Red, Green, and Blue. The
intensity of colors is represented using numbers 0 to 256. This allows CSS to have a
spectrum of visible colors.
Class is a way of using HTML elements for styling. They are not unique and have multiple
elements. Whereas ID is unique and it can be assigned to a single element.
Responsive Design is a web page creation approach that uses flexible images, flexible
layouts, and CSS media queries. This design approach aims to build web pages that
detect the orientation and screen size of the visitors so that the layout can be changed
accordingly.
Cascading is defined as the process of style declaration and its weight that will help the
browser in selecting the styling rules with respect to time.
By Aman Khan 18
HTML, CSS & BOOTSTRAP INTERVIEW QUESTIONS WITH ANSWERS
95. What are the different ways to hide the element using CSS?
Marquee is used for scrolling text on a web page. It scrolls the image or text up, down,
left, or right automatically. To apply for a marquee, you have to use </marquee> tags.
We can insert a comment in HTML by beginning with a lesser than sign and ending with
a greater than sign. For example, “<!-“ and “->.”
The alt attribute is used for displaying a text in place of an image whenever the image
cannot be loaded due to any technical issue.
A form is a set of input fields and other elements to collect user data. Forms can be used
for various purposes, such as logging in, submitting feedback, or purchasing.
The method attribute is used to specify the HTTP method that will be used to submit the
form data. The two most common methods are GET and POST. GET is used to retrieve
data from the server, while POST is used to send data to the server
By Aman Khan 19