0% found this document useful (0 votes)
112 views

Css Interview Questions and Answers

Interview questiond

Uploaded by

nikithanikki502
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
112 views

Css Interview Questions and Answers

Interview questiond

Uploaded by

nikithanikki502
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

CSS Interview Questions and Answers for Freshers

1. Name different ways to position some aspects in CSS


In CSS there are five different ways to position the element. And the values are fixed,
static, absolute, sticky and relative.

2. How is a CSS selector used?


CSS selectors are used to target the HTML element on which we want to add style. In
CSS there are different type of selectors and their selectors are class selector, id
selector, element selector, type selector, etc.

3. What are the properties of flexbox?


CSS flexbox contains various properties and some CSS flexbox properties are flex-
direction, flex-wrap, flex-flow, flex-content, and align-items and more.

4. What is common between class and ID?


class and ID are used in HTML to assign a value from CSS. These are CSS selectors.

5. Differentiate between logical and physical tags.


In HTML logical tags are used to provide information by giving the special importance
to the text. And example of HTML logical tags are <em>, <strong>, etc.

In HTML physical tags are used to style the content only. And example of
HTML physical tags are <i>, <b>, etc.

6. Explain the term Responsive web design.


Responsive design is a way of creating web pages that includes flexible layouts,
flexible images, and cascading style sheet media queries. The purpose of responsive
design is to create web pages that recognize the size and orientation of the user’s
screen and adjust the layout accordingly.

All rights reserved – designwithrehana.com


7. What is CSS specificity?
In CSS, if there are two or more CSS rules that point to the same element, the selector
who has the highest specificity value will be applied to that HTML element and “win”.

8. What is CSS opacity?


CSS opacity-level describes the transparency-level of an element. If a HTML element
contains 1 opacity value, then it will be fully visible to the user and if opacity value is 0.5
will be 50% see-through, and if the opacity value is 0 then the HTML element will be
completely transparent.

Note: When using the opacity property to add transparency to the background of an
element, all of its child elements become transparent as well.

9. What is the difference between padding and margin?


Margin: Margin is the outer space of an element. The margin is applied outside of the
element’s border.

Padding: Padding is the inner space of an element. The padding is applied inside of
the element’s border.

10. What is meant by a universal selector?


In CSS, the asterisk (*) is known as the CSS universal selectors. It can be used to select
all types of elements in an HTML page.

For example:

*{

property: value;

All rights reserved – designwithrehana.com


11. What is the float property of CSS?
In CSS, the float property specifies whether an element should float. It specify that the
element should be float on the left, right, or not at all. And Absolute positioned
elements ignore the float property!

Note: It is best practice to always use clear property.

12. What is the difference between visibility: hidden and display:


none?
visibility: hidden- In the visibility:hidden; property the content will not be visible to the
user but it will takes up its original space.

whereas,

display: none- In display:none; property the content will hidden and is hidden and
takes no space.

13. What are the external style sheets?


An external style sheet is different/separate CSS file with .css extension. This stylesheet
can be accessed by creating a link within the head section of the HTML document.

14. How case-sensitive is CSS?


CSS is not case sensitive. However, font families, URLs to images, and other direct
references with the style sheet may be. The trick is that if you write a document using
an XML declaration and an XHTML doctype, then the CSS class names will be case
sensitive for some browsers.

15. Is it possible to add multiple declaration in CSS?


Yes, it is possible to add multiple declaration in CSS. The declaration block contains
one or more declarations separated by semicolons. And each declaration includes a
CSS property name and a value, which is separated by a colon.

Multiple CSS declarations are separated with semicolons, and declaration blocks are
surrounded by curly braces.

All rights reserved – designwithrehana.com


16. What are the different font attributes available in CSS?
Here is the list of different font attributes available in CSS

• font-family
• font-size
• font-stretch
• font-style
• font-weight
• font-variant
• line-height
17. What are pseudo-elements?
CSS pseudo-elements are used to style specified parts of an HTML element.

For example, pseudo-elements can be used to:

• Style the first letter or line of an element.


• Insert content before or after the content of an element.

All rights reserved – designwithrehana.com

You might also like