Latest HTML & CSS Interview Questions for 2024

1) CSS stands for -

  1. Cascade style sheets

  2. Color and style sheets

  3. Cascading style sheets

  4. None of the above

Answer: (c) Cascading style sheets

 

2) Which of the following is the correct syntax for referring the external style sheet?

  1. <style src = example.css>

  2. <style src = "example.css" >

  3. <stylesheet> example.css </stylesheet>

  4. <link rel="stylesheet" type="text/css" href="example.css">

Answer: (d) <link rel="stylesheet" type="text/css" href="example.css">

3) The property in CSS used to change the background color of an element is -

  1. bgcolor

  2. color

  3. background-color

  4. All of the above

Answer: (c) background-color

4) The property in CSS used to change the text color of an element is -

  1. bgcolor

  2. color

  3. background-color

  4. All of the above

Answer: (b) color

5) The CSS property used to control the element's font-size is -

  1. text-style

  2. text-size

  3. font-size

  4. None of the above

Answer: (c) font-size

6) The HTML attribute used to define the inline styles is -

  1. style

  2. styles

  3. class

  4. None of the above

Answer: (a) style

7) The HTML attribute used to define the internal stylesheet is -

  1. <style>

  2. style

  3. <link>

  4. <script>

Answer: (a) <style>

8) Which of the following CSS property is used to set the background image of an element?

  1. background-attachment

  2. background-image

  3. background-color

  4. None of the above

Answer: (b) background-image

9) Which of the following is the correct syntax to make the background-color of all paragraph elements to yellow?

  1. p {background-color : yellow;}

  2. p {background-color : #yellow;}

  3. all {background-color : yellow;}

  4. all p {background-color : #yellow;}

Answer: (a) p {background-color : yellow;}

10) Which of the following is the correct syntax to display the hyperlinks without any underline?

  1. a {text-decoration : underline;}

  2. a {decoration : no-underline;}

  3. a {text-decoration : none;}

  4. None of the above

Answer: (c) a {text-decoration : none;}

11) Which of the following property is used as the shorthand property for the padding properties?

  1. padding-left

  2. padding-right

  3. padding

  4. All of the above

Answer: (c) padding

12) The CSS property used to make the text bold is -

  1. font-weight : bold

  2. weight: bold

  3. font: bold

  4. style: bold

Answer: (a) font-weight : bold

13) Are the negative values allowed in padding property?

  1. Yes

  2. No

  3. Can't say

  4. May be

Answer: (b) No

14) Which of the following property is used as the shorthand property of margin properties?

  1. margin-left

  2. margin-right

  3. margin

  4. None of the above

Answer: (c) margin

15) The CSS property used to specify the transparency of an element is -

  1. opacity

  2. filter

  3. visibility

  4. overlay

Answer: (a) opacity

16) Which of the following is used to specify the subscript of text using CSS?

  1. vertical-align: sub

  2. vertical-align: super

  3. vertical-align: subscript

  4. None of the above

Answer: (a) vertical-align : sub

17) Which of the following CSS property is used to specify the space between every letter inside an element?

  1. alpha-spacing

  2. character-spacing

  3. letter-spacing

  4. alphabet-spacing

Answer: (c) letter-spacing

18) The CSS property used to specify whether the text is written in the horizontal or vertical direction?

  1. writing-mode

  2. text-indent

  3. word-break

  4. None of the above

Answer: (a) writing-mode

19) Which of the following syntax is correct in CSS to make each word of a sentence start with a capital letter?

  1. text-style : capital;

  2. transform : capitalize;

  3. text-transform : capital;

  4. text-transform : capitalize;

Answer: (d) text-transform : capitalize;

20) How to select the elements with the class name "example"?

  1. example

  2. #example

  3. .example

  4. Class example

Answer: (c) .example

21) Which of the following is the correct syntax to select all paragraph elements in a div element?

  1. div p

  2. p

  3. div#p

  4. div ~ p

Answer: (a) div p

22) Which of the following is the correct syntax to select the p siblings of a div element?

  1. p

  2. div + p

  3. div p

  4. div ~ p

 

Answer: (d) div ~ p


23) The CSS property used to draw a line around the elements outside the border?

  1. border

  2. outline

  3. padding

  4. line

Answer: (b) outline

 

Categories: web designing web development digital marketing php css jquery codeigniter ajax json laravel react front end developer wordpress basic computer programming c programming c programming core java programming python programming mysql

Blog Categories
Trending Courses

CodeIgniter

Regular : 45 Days

Fastrack : 20 Days

Crash : 10 Days

Advance Digital Marketing Expert Course

Regular : 6 Months

Fastrack : 3 Months

Crash : 2 Months

React JS

Regular : 45 Days

Fastrack : 25 Days

Crash : 15 Days

Laravel

Regular : 45 Days

Fastrack : 20 Days

Crash : 10 Days

Front End Developer

Regular : 6 Months

Fastrack : 4 Months

Crash : 2 Months

Python

Regular : 30 Days

Fastrack : 15 Days

Crash : 10 Days

Request For Demo