HTML & CSS Basics MCQs with Answers
What does HTML stand for?
a) Hyper Text Markup Language
b) Hyper Transfer Markup Language
c) Home Tool Markup Language
d) Hyperlink Markup Language
Which of the following is the correct way to add a CSS style in an HTML document?
a) <style> tag
b) <css> tag
c) style attribute in HTML tag
d) Both a and c
Which tag is used to create a hyperlink in HTML?
a) <link>
b) <a>
c) <href>
d) <hyperlink>
Which property is used to change the background color in CSS?
a) background-color
b) color
c) bg-color
d) background
Which of the following is the correct syntax to apply a CSS class to an HTML element?
a) <div .class-name>
b) <div class=”class-name”>
c) <div name=”class-name”>
d) <div #class-name>
What does the <img> tag do in HTML?
a) Embeds a video
b) Displays an image
c) Embeds audio
d) Creates a hyperlink
Which of the following is used to apply a CSS style to a specific HTML element?
a) Class selector
b) ID selector
c) Universal selector
d) All of the above
What is the correct syntax to create a comment in CSS?
a) // Comment
b) /* Comment */
c) <!– Comment –>
d) // This is a comment
What is the default value of the position property in CSS?
a) static
b) absolute
c) relative
d) fixed
Which of the following is the correct syntax to link an external CSS file in HTML?
a) <link rel=”stylesheet” href=”style.css”>
b) <stylesheet src=”style.css”>
c) <css href=”style.css”>
d) <link rel=”css” href=”style.css”>
Which of the following is used to define a table in HTML?
a) <table>
b) <table-define>
c) <tbl>
d) <tble>
Which of the following is a valid CSS unit of measurement?
a) em
b) cm
c) px
d) All of the above
Which HTML tag is used to display a horizontal rule (line) on a webpage?
a) <hr>
b) <line>
c) <break>
d) <rule>
What is the correct HTML element to specify a navigation bar?
a) <navbar>
b) <nav>
c) <navigation>
d) <navigation-bar>
Which of the following CSS properties is used to control the font size?
a) font-style
b) font-size
c) font-weight
d) text-size
How do you make a list of items in HTML?
a) <list>
b) <li>
c) <ul>
d) <ol>
Which of the following is used to define an unordered list in HTML?
a) <ol>
b) <ul>
c) <li>
d) <list>
Which property is used to set the space between words in CSS?
a) word-spacing
b) letter-spacing
c) text-spacing
d) line-spacing
What is the correct HTML element to display a paragraph?
a) <par>
b) <paragraph>
c) <p>
d) <text>
Which HTML attribute is used to specify an image’s alternative text?
a) alt
b) src
c) title
d) img
How do you select all paragraphs in CSS?
a) p {}
b) .p {}
c) #p {}
d) * {}
What is the correct way to create an ordered list in HTML?
a) <ol>
b) <ul>
c) <li>
d) <list>
Which CSS property is used to change the font family?
a) font-style
b) font-family
c) font-weight
d) text-font
Which of the following is used to define a comment in HTML?
a) <!– –>
b) //
c) /* */
d) #
What is the default display value of a <div> element in CSS?
a) inline
b) block
c) inline-block
d) none
What is the correct HTML tag for embedding a video?
a) <movie>
b) <video>
c) <media>
d) <embed-video>
How do you make text bold in CSS?
a) font-weight: bold;
b) font-style: bold;
c) text-bold: true;
d) font-size: bold;
Which of the following is used to add a border to an HTML element in CSS?
a) border-style
b) border-width
c) border-color
d) border
What is the correct HTML element to specify a header for a document or section?
a) <header>
b) <head>
c) <h1>
d) <section>
What is the purpose of the z-index property in CSS?
a) To set the position of an element
b) To control the stacking order of elements
c) To apply animation to elements
d) To change the text color of an element
What does the border-radius property do in CSS?
a) Defines the size of the border
b) Rounds the corners of an element
c) Changes the width of the border
d) Changes the color of the border