MCQ

HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 4

Multiple choice questions and answers (MCQs) on HTML/CSS to prepare for exams, tests, and certifications. These questions are taken from a real written exam and some parts are taken from an interview. So you will find questions on basic techniques such as tags, web standards, CSS selector, objects, and more. This quiz will easily prepare anyone to pass their online test.
 

1. Which of the following HTML tags will insert a line break?

A <p>

B <break>

C <line>

D <br>

D
The <br> tag indicates a line break.

 

 

2. Which of the following tags are related to a table in HTML?

A <table> <row> <column>

B <table> <tr> <td>

C <table> <head> <body>

D <table> <header> <footer>
 

 
B
Example to create a table in HTML:
<table>
  <tr>
    <td>....</td>
    <td>....</td> 
  </tr>
  <tr>
    <td>....</td>
    <td>....</td> 
  </tr>
</table>

 

 

3. What is the purpose of the <tt> tag in HTML?

A The tag <tt> is one of the text formatting tags.

B The tag <tt> is one of the image formatting tags.

C The tag <tt> is one of the table formatting tags.

D None of the above

A
The tag <tt> is one of the text formatting tags. Example :

<p><tt>Teletype text</tt></p>

Output:
 
Teletype text

 

 

4. What is the purpose of HTML forms?

A To display the content of an email.

B To display animation effect.

C To collect user input.

D None of the above

C
The <form> tag defines a form that is used to collect user input. Example :
<form>
  First name:
  <input type="text" name="firstname">
  Last name:
  <input type="text" name="lastname">
</form>

Output:
 

 

 

5. What is iframe used for in HTML?

A To display a web page within a web page.

B To display a web page with an animation effect.

C To display a web page without a browser.

D All the answers are true

A
An IFrame is HTML code that you can use to embed an HTML page, PDF page, other website or other secure file on the Internet into another web page within a window. Example:
<iframe src="https://stackhowto.com" height="300" width="400">

 

 

6. How to write a comment in CSS?

A /* comment */

B // comment //

C / comment /

D <‘ comment ‘>

A
 
 

7. What css property would you use if you wanted to add a margin between the border of a DIV and its interior text?

A spacing

B margin

C padding

D inner-margin

C
Example :


 

 

8. Which CSS property is used to control the text size of an element?

A font-style

B text-size

C font-size

D text-style

C
The “font-size” property allows you to define the font size for different elements. Example:
div { font-size: 15px; }

 

 
 

9. The default value for the “position” attribute is _________.

A fixed

B absolute

C inherit

D relative

D
The “position” property specifies the type of positioning used for an element (it can be static, relative, fixed, absolute or sticky).

 

 

10. How to make all paragraphs “RED”?

A p.all {color: red;}

B p.all {color: #AA0000;}

C all.p {color: #0000FF;}

D p {color: red;}

D
HTML colors are specified using their names or with RGB, HEX, HSL, RGBA, HSLA values.

 

mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *