Top 50 CSS Interview Questions and Answers (2024)
Top 50 CSS Interview Questions and Answers (2024)
Top 50 CSS Interview Questions and Answers (2024)
1. What is CSS ?
The full form of CSS is Cascading Style Sheets. It is a styling language which is simple
enough for HTML elements. It is popular in web designing, and its application is common
in XHTML also.
• CSS 1
• CSS 2
• CSS 2.1
1 of 22 4/18/2024, 7:00 PM
Top 50 CSS Interview Questions and Answers (2024) https://career.guru99.com/top-50-csscascading-style-sheet-interview-que...
• CSS 3
• CSS 4
EXPLORE MORE
Top 10 Behavioral
Interview Questions and
Answers
04:00
02:11
Top 5 Powerpoint
Interview Questions and
• Bandwidth
• Site-wide consistency
• Page reformatting
• Accessibility
• Content separated from presentation
2 of 22 4/18/2024, 7:00 PM
Top 50 CSS Interview Questions and Answers (2024) https://career.guru99.com/top-50-csscascading-style-sheet-interview-que...
The margin-left and margin-right properties can be set to some explicit value:
BODY {
width: 40em;
background: fluorescent;
P {
width: 30em;
margin-right: auto;
3 of 22 4/18/2024, 7:00 PM
Top 50 CSS Interview Questions and Answers (2024) https://career.guru99.com/top-50-csscascading-style-sheet-interview-que...
margin-left: auto
In this case, the left and right margins will be each, five ems wide since they split up the
ten ems left over from (40em-30em). It was unnecessary for setting up an explicit width
for the BODY element; it was done here for simplicity.
• Inline: Style attribute can be used to have CSS applied HTML elements.
• Embedded: The Head element can have a Style element within which the code can
be placed.
• Linked/ Imported: CSS can be placed in an external file and linked via link element.
4 of 22 4/18/2024, 7:00 PM
Top 50 CSS Interview Questions and Answers (2024) https://career.guru99.com/top-50-csscascading-style-sheet-interview-que...
• One file can be used to control multiple documents having different styles.
• Multiple HTML elements can have many documents, which can have classes.
• To group styles in composite situations, methods as selector and grouping are used.
Demerits:
5 of 22 4/18/2024, 7:00 PM
Top 50 CSS Interview Questions and Answers (2024) https://career.guru99.com/top-50-csscascading-style-sheet-interview-que...
6 of 22 4/18/2024, 7:00 PM
Top 50 CSS Interview Questions and Answers (2024) https://career.guru99.com/top-50-csscascading-style-sheet-interview-que...
• Font-style
• Font-variant
• Font-weight
• Font-size/line-height
• Font-family
• Caption
• Icon
7 of 22 4/18/2024, 7:00 PM
Top 50 CSS Interview Questions and Answers (2024) https://career.guru99.com/top-50-csscascading-style-sheet-interview-que...
Classname
it can be A-Z, a-z or digits.
.top {font: 14em ;}, class selector
<Body class= “top”> this class is associated with element </body>
8 of 22 4/18/2024, 7:00 PM
Top 50 CSS Interview Questions and Answers (2024) https://career.guru99.com/top-50-csscascading-style-sheet-interview-que...
Control statements and external style sheets are used to overrule underlining Hyperlinks.
E.g.:
B {
text-decoration: none;
26. What happens if 100% width is used along with floats all
across the page?
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.
They are:
9 of 22 4/18/2024, 7:00 PM
Top 50 CSS Interview Questions and Answers (2024) https://career.guru99.com/top-50-csscascading-style-sheet-interview-que...
29. What is CSS Box Model and what are its elements?
This box defines design and layout of elements of CSS. The elements are:
10 of 22 4/18/2024, 7:00 PM
Top 50 CSS Interview Questions and Answers (2024) https://career.guru99.com/top-50-csscascading-style-sheet-interview-que...
CSS coding:
In this case, only the part needed is used. The user can save substantial margin and time
through this.
11 of 22 4/18/2024, 7:00 PM
Top 50 CSS Interview Questions and Answers (2024) https://career.guru99.com/top-50-csscascading-style-sheet-interview-que...
h1 {
color: blue;
h2 {
color: blue;
p {
color: blue;
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.
color: red;
text-align: left;
.marked
12 of 22 4/18/2024, 7:00 PM
Top 50 CSS Interview Questions and Answers (2024) https://career.guru99.com/top-50-csscascading-style-sheet-interview-que...
background-color: blue;
.marked p
color: green;
• Height
• Max-height
• Max-width
• Min-height
• Min-width
• Width
13 of 22 4/18/2024, 7:00 PM
Top 50 CSS Interview Questions and Answers (2024) https://career.guru99.com/top-50-csscascading-style-sheet-interview-que...
CSS
14 of 22 4/18/2024, 7:00 PM
Top 50 CSS Interview Questions and Answers (2024) https://career.guru99.com/top-50-csscascading-style-sheet-interview-que...
15 of 22 4/18/2024, 7:00 PM
Top 50 CSS Interview Questions and Answers (2024) https://career.guru99.com/top-50-csscascading-style-sheet-interview-que...
50. How can CSS be cascaded to mix with user’s personal sheet?
Properties can be a set in recommended places and the document modified for CSS to
mix with user’s personal sheet.
These interview questions will also help in your viva(orals). In every industry, the use of
websites and web applications is increasing day by day, and CSS is an essential part to
build attractive websites. So, there is a huge demand for UI/UX and Web designers
having a good knowledge of CSS with HTML.
Share
16 of 22 4/18/2024, 7:00 PM