HTML Css Questions Answers For Interview Students Competitive Exams
HTML Css Questions Answers For Interview Students Competitive Exams
QUESTIONS &
ANSWERS FOR
I N T E RV I E W,
STUDENTS,
COMPETITIVE EXAMS
Editor
Swawon Mondal
TABLE OF CONTENT
HTML………………………………. 1
CSS…………………………………. 43
1. What is HTML?
Ans: HTML stands for Hyper Text Markup Language. It is a language of
World Wide Web. It is a standard text formatting language which is used to
create and display pages on the Web. It makes the text more interactive and
dynamic. It can turn text into images, tables, links.
When a web browser reads an HTML document, the browser reads it from
top to bottom and left to right. HTML tags are used to create HTML
documents and render their properties. Each HTML tags have different
properties.
Syntax
<tag> content </tag>
Content is placed between tags to display data on the web page.
6. What are some common lists that are used when designing a
page?
Ans: There are many common lists which are used to design a page. You
can choose any or a combination of the following list types:
Ordered list - The ordered list displays elements in numbered
format. It is represented by <ol> tag.
Unordered list - The unordered list displays elements in bulleted
format. It is represented by <ul> tag.
Definition list - The definition list displays elements in definition
form like in dictionary. The <dl>, <dt> and <dd> tags are used to
define description list.
For example:
1. <!DOCTYPE html>
2. <html>
3. <body>
4. <h2> HTML Iframes example</h2>
5. <p> Use the height and width attributes to specify the size of the
iframe:</p>
6. <iframe src ="https://www.google.com/" height ="300" width
="400" ></iframe>
7. </body>
8. </html>
Here, replace the "image.gif" with the name of your image file which you
want to display on your web page.
1. <p>
2. <span style ="color:#ffffff;" >
3. In this page we use span.
4. </span>
5. </p>
Example:
Target to a link:
Let's see the code to play mp3 file using HTML audio tag.
1. <audio controls>
2. <source src ="koyal.mp3" type ="audio/mpeg" >
3. Your browser does not support the html audio tag.
4. </audio>
4. </figure>
34. What is the use of figcaption tag in HTML 5?
Ans: The <figcaption> element is used to provide a caption to an image. It
is an optional tag and can appear before or after the content within the
<figure> tag. The <figcaption> element is used with <figure> element and
it can be placed as the first or last child of the <figure> element.
1. <figure>
2. <img src ="htmlpages/images/tajmahal.jpg" alt ="Taj Mahal" />
1. <label>
2. Enter your favorite cricket player: Press any character<br />
3. <input type ="text" id ="favCktPlayer" list ="CktPlayers" >
4. <datalist id ="CktPlayers" >
5. <option value ="Sachin Tendulkar" >
6. <option value ="Brian Lara" >
7. <option value ="Jacques Kallis" >
8. <option value ="Ricky Ponting" >
9. <option value ="Rahul Dravid" >
10. <option value = "Shane Warne" >
11. <option value = "Rohit Sharma" >
12. <option value = "Donald Bradman" >
13. <option value = "Saurav Ganguly " >
14. <option value = "AB diVilliers" >
15. <option value = "Mahendra Singh Dhoni" >
16. <option value = "Adam Gilchrist" >
17. </datalist>
18. </label>
40. What are the new <input> types for form validation in
HTML5?
Ans: The new input types for form validation are email, URL, number, tel,
and date.
Example:
CSS 1
CSS 2
CSS 2.1
CSS 3
CSS 4
Demerits:
Extra download is needed to import documents having style
information.
To render the document, the external style sheet should be
loaded.
Not practical for small style definitions.
66. What happens if 100% width is used along with floats all
across the page?
Ans: While making the float declaration, 1 pixel is added every time it is
used in the form of the border, and even more float is allowed thereafter.
67. Can default property value be restored through CSS? If
yes, how?
Ans: In CSS, you cannot revert back to old values due to lack of default
values. The property can be re- declared to get the default property.
68. Enlist the various Media types used?
Ans: Different media has different properties as they are case insensitive.
They are:
69. What is CSS Box Model and what are its elements?
Ans: This box defines design and layout of elements of CSS. The elements
are:
Margin : the top most layer, the overall structure is shown
Border : the padding and content option with a border around it is shown.
Background color affects the border.
Padding : Space is shown. Background colour affects the border.
Content : Actual content is shown.
1 h1 {
2
3 color: blue;
4}
5 h2 {
6
7 color: blue;
8 }
9
1 p{
0
1 color: blue;
1 }
1
2
1
3
1
4
1
5
1
6
1
7
It can be seen from the code that every element shares the same property.
Rewriting can be avoided by writing each selector separated by a comma.
Nesting: Specifying a selector within a selector is called nesting.
1 P
2
3 {
4 color: red;
5
6 text-align: left;
7
8 }
9 .marked
1 {
0
1 background-color: blue;
1 }
1
2 .marked p
1
3 {
1
color: green;
4
1 }
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
2
4
2
5