CSS fresher interview question /CSS Interview Questions and Answers for Freshers & Experienced

State the difference between Style Sheet and HTML?

HTML lacks styling even though HTML has an easy structure method. Styling Sheets not only offer styling but also have better formatting options and browsing capabilities.

Posted Date:- 2021-08-21 11:34:26

What are the media types allowed by CSS?

Media furnishes the customisation and design of the documents. Media control can be used to retrieve and use external style sheets by loading them from the network.

Posted Date:- 2021-08-21 11:33:27

What is the usage of Class selector?

Selectors that are unique to a specific style, are called CLASS selectors. Declaration of style and association with HTML can be made through this. Syntax:

it can be A-Z, a-z or digits.
.top {font: 14em ;}, class selector
<Body class= “top”> this class is associated with element </body>

Posted Date:- 2021-08-21 11:32:37

Why is it easy to insert a file by importing it?

Importing enables combining external sheets to be inserted in many sheets. Different files and sheets can be used to have different functions. Syntax:

@import notation, used with <Style> tag.

Posted Date:- 2021-08-21 11:31:39

Comment on the Case-sensitivity of CSS ?

Although, there are no case-sensitivity of CSS, nevertheless font families, URL’s of images, etc is. Only when XML declarations along with XHTML DOCTYPE are being used on the page, CSS is case -sensitive.

Posted Date:- 2021-08-21 11:29:42

What are navigation bars in CSS?

By using navigation bars we can make an ordinary HTML page into a user-specific and more dynamic web page. Basically, it is a list of links, hence use of <ul> and <li> elements makes the perfect sense.

ul {
list-style-type: none;
margin: 0;
padding: 0;

Posted Date:- 2021-08-21 11:28:13

Write all the position states used in CSS.

In CSS, there are four position states as stated below:


Posted Date:- 2021-08-21 11:26:59

Explain the concept of pseudo-elements in CSS.

It is a feature of CSS which is used to style the given parts of an element.

For Example,
we can style the first letter or line of an HTML element.
selector::pseudo-element {

Posted Date:- 2021-08-21 11:25:27

What is a CSS pseudo-class?

It is a class that is used to define a special state of an HTML element.
This class can be used by styling an element when a user snooped over it and also it can style an HTML element when it gets the focus.

selector:pseudo-class {

Posted Date:- 2021-08-21 11:24:24

How can we add icons to the web page?

We can add icons to the HTML webpage by using an icon library like font-awesome.
We have to add the name of the given icon class to any inline HTML element. (<i> or <span>) . Icons in the icon libraries are scalable vectors that can be customized with CSS.

Posted Date:- 2021-08-21 11:23:23

How would you style an image or element to have rounded corners?

Use the border-radius property to add rounded corners to an image. 50% will make the image circular.

border-radius: 50%;

Posted Date:- 2021-08-21 11:22:22

What are contextual selectors?

Contextual selectors in CSS allow you to specify different styles for different parts of your document. You can assign styles directly to specific HTML tags, or, you could create independent classes and assign them to tags in the HTML. Either approach lets you mix and match styles.

Posted Date:- 2021-08-21 11:20:38

What is the use of box-shadow in CSS?

The box-shadow CSS property adds shadow effects around an element’s frame. You can set multiple effects separated by commas. A box-shadow is described by X and Y offsets relative to the element, color, blur and spread radii. Below are a few implementations of box-shadow

box-shadow: 10px 5px 5px red;

box-shadow: 60px -16px teal;

box-shadow: 12px 12px 2px 1px rgba(0, 0, 255, .2);

box-shadow: inset 5em 1em gold;

Posted Date:- 2021-08-21 11:18:59

What are the advantages and disadvantages of embedded style sheets?


1.You can create different tag types inside a document.
2.The additional download is not required, unlike external style sheets.
3.In complicated situations, you can use Grouping and Selector methods to apply styles.


You cannot control multiple documents.

Posted Date:- 2021-08-21 11:17:45

What are the ways to integrate CSS as a web page?

There are three methods to integrate CSS in the form of a web page:

Embedded: There can be a style element inside the head element inside which we can place the code.

Inline: CSS applied HTML elements can be found using style attributes.

Imported or Linked: In the case of linked or imported CSS, the CSS is placed in an external file and a link element is used to link it.

Posted Date:- 2021-08-21 11:16:04

What is the difference between padding and margin?

The difference between padding and margin In CSS, the margin is the property by which we can create space around elements. We can even create space to the exterior defined borders.
In CSS, we have margin property as follows:


Posted Date:- 2021-08-21 11:14:50

Write all the properties of the flexbox.

There are several properties of the flexbox that are used in the HTML webpage.

They are:

1. flex-direction
2. flex-wrap
3. flex-flow
5. align-items
6. align-content

Posted Date:- 2021-08-21 11:13:20

Differentiate Style Sheet concept from HTML?

While HTML provides easy structure method, it lacks styling, unlike Style sheets. Moreover, style sheets have better browser capabilities and formatting options.

Posted Date:- 2021-08-21 11:10:06

Differentiate logical tags from physical tags?

1. While physical tags are also referred to as presentational mark-up, logical tags are useless for appearances.
2. Physical tags are newer versions while logical tags are old and concentrate on content.

Posted Date:- 2021-08-21 11:09:23

Why should background and color be used as separate properties?

This is done with mainly two purposes:
1. It makes the style sheets more legible. Background property, which is complex in itself, becomes all the more complex with color.
2. Color is an in-built property while the background is not one. And this can lead to a lot of confusion.

Posted Date:- 2021-08-21 11:08:32

Which property controls the image scroll in the background?

Image scroll in the background can be controlled using the background-scroll property.

Posted Date:- 2021-08-21 11:07:20

How can image repetition of the backup be controlled?

Background-repetition property controls the repetition of images in the background. Use no-repeat if the image is to be displayed once in the background.

body {
background-image: url("/css/images/css.jpg");
background-repeat: repeat;
<p>CSS Background Image: Hackr.io</p>

Posted Date:- 2021-08-21 11:06:14

How can the background color of an element be changed?

The background color of an image can be changed using the background-color property.


background-color: coral;

Posted Date:- 2021-08-21 11:04:49

Name a few CSS style components

A few CSS style components include Property, Value, and Selector

Posted Date:- 2021-08-21 11:03:42

What is the property that is used for controlling image-scroll?

The background-attachment property sets whether a background image scrolls with the rest of the page, or is fixed. Here is an example of a background-image that will not scroll with the page (fixed):
body {
background-image: url("img_tree.gif");
background-repeat: no-repeat;
background-attachment: fixed;

Posted Date:- 2021-08-21 11:02:58

What is the overflow property in CSS used for?

The overflow property specifies what should happen if content overflows an element’s box. This property specifies whether to clip content or to add scrollbars when an element’s content is too big to fit in a specified area. Below are the overflow options available in CSS –

overflow: auto;

overflow: none;

overflow: scroll;

overflow: visible;

Posted Date:- 2021-08-21 11:02:04

How will you target an h2 and h3 with the same styling?

You can target multiple elements by separating the separators with a comma (,)
h2, h3 {

color: blue;


Posted Date:- 2021-08-21 11:01:02

What is the z-index in CSS?

The z-index helps specify the stack order of positioned elements that may overlap one another. The z-index default value is zero and can take on either a positive or negative number.

An element with a higher z-index is always stacked above than a lower index.

Z-Index can take the following values:

1. Auto: Sets the stack order equal to its parents.
2. Number: Orders the stack order.
3. Initial: Sets this property to its default value (0).
4. Inherit: Inherits this property from its parent element.

Posted Date:- 2021-08-21 10:57:29

What are the ways to assign a certain colour to an element in CSS?

CSS can assign a wide range of colours to elements using different notations. There are three notations as of now that are used that are explained below:

1. Hexadecimal notation
A colour in hexadecimal string notation always begins with the character “#”. After that, the hexadecimal digits of the colour code is written. The string is case-insensitive.
2. RGB functional notation
RGB (Red/Green/Blue) functional notation, like hexadecimal string notation, represents colours using their red, green, and blue components (as well as, optionally, an alpha channel component for opacity). However, instead of using a string, the colour is defined using the CSS function RGB(). This function accepts as its input parameters the values of the red, green, and blue components and an optional fourth parameter, the value for the alpha channel.
3.HSL functional notation
Designers and artists often prefer to work using the HSL (Hue/Saturation/Luminosity) colour method. On the web, HSL colours are represented using HSL functional notation. The HSL() CSS function is very similar to the RGB() function in usage otherwise

Posted Date:- 2021-08-21 10:55:39

What is the RGB stream?

RGB is a system of representing a certain colour in CSS. There are three streams in this nomenclature of representing a colour, namely the Red, Green and Blue stream. The intensity of the three colours is represented in numbers ranging from 0 to 256. This allows CSS to have a wide range of colours spreading across the entire spectrum of visible colours.
These conclude the easy section. Here is getting started documentation for CSS. Things are going to get a much more particular now. It’s time for intermediate CSS interview questions.

Posted Date:- 2021-08-21 10:54:04

What are the different ways you could integrate CSS into your HTML page?

There are three ways that you could integrate a certain CSS style:

1. You can integrate your style using the style-tags in the head section of your HTML page.
2. You can integrate your style using inline-styling.
3. You can write your CSS in a separate file and add it to your HTML page using the link tag.

Posted Date:- 2021-08-21 10:53:19

State the benefits and disadvantages of Embedded Style Sheets?


1.The extra download is not needed.
In a single document, multiple types of tags can be created.
2.Selector and grouping methods can be used to apply styles in complex situations.The extra download is not needed.
3.In a single document, multiple types of tags can be created.

1. Cannot be used to control multiple documents.

Posted Date:- 2021-08-21 10:51:56

What merits and disadvantages do External Style Sheets offer?


1.Only one file can be utilised to take control of various documents each having different styles.
2.Multiple elements of HTML can have multiple documents which can then have multiple classes.
3.Composite situations, grouping, and methods as selectors can be used to group styles.


1.For documents having different style information, an extra download is needed.
2.External style sheets have to be downloaded to furnish the document.
3.It is not practical for definitions of small style.

Posted Date:- 2021-08-21 10:49:43

Who postulates the specifications of CSS?

CSS specifications are maintained by the World Wide Web Consortium.

Posted Date:- 2021-08-21 10:48:08

Enlist the media types CSS allows?

The design and customization of documents are rendered by media. By applying media control over the external style sheets, they can be retrieved and used by loading it from the network.

Posted Date:- 2021-08-21 10:47:31

What does CSS selector mean?

A string equivalent of HTML elements by which declarations or a set of it, is declared and is a link that can be referred for linking HTML and Style sheet is CSS selector.

Posted Date:- 2021-08-21 10:46:43

In how many ways can a CSS be integrated as a web page?

CSS can be integrated in three ways:

a.Inline: Style attribute can be used to have CSS applied HTML elements.
b. Embedded: The Head element can have a Style element within which the code can be placed.
c.Linked/ Imported: CSS can be placed in an external file and linked via link element.

Posted Date:- 2021-08-21 10:46:05

How block elements can be centered with CSS1?

Block level elements can be centered by:

The margin-left and margin-right properties can be set to some explicit value:

width: 40em;

background: fluorescent;


P {

width: 30em;

margin-right: auto;

margin-left: auto


Posted Date:- 2021-08-21 10:44:54

What are CSS frameworks?

It is a pre-planned libraries, which allows easier and more standards-compliant webpage styling, using CSS language.

Posted Date:- 2021-08-21 10:43:52

What are the advantages of CSS ?

Advantages are:

Site-wide consistency
Page reformatting
Content separated from presentation

Posted Date:- 2021-08-21 10:42:57

How can we calculate specificity?

To calculate specificity we will start with 0, then we have to add 1000 for each ID and we have to add 10 to the attributes, classes or pseudo-classes with each element name or pseudo-element and later we have to add 1 to them.

#content h2
<div id=”content”>
<h2 style=”color:#FF0000”>heading</h2>

Posted Date:- 2021-08-21 10:39:41

What are CSS counters?

CSS counters are variables that can be incremented by rules of CSS that inspector track how many times the variable has been used.

Posted Date:- 2021-08-21 10:38:16

Explain the term Responsive web design.

It is a method in which we design and develop a web page according to the user activities and conditions which are based on various components like the size of the screen, portability of the web page on the different devices, etc. It is done by using different flexible layouts and grids.

Posted Date:- 2021-08-21 10:37:32

What are the limitations of CSS ?

Limitations are:

Ascending by selectors is not possible
Limitations of vertical control
No expressions
No column declaration
Pseudo-class not controlled by dynamic behavior
Rules, styles, targeting specific text not possible

Posted Date:- 2021-08-21 10:17:11

Explain the concept of Tweening.

Tweening is the process in which we create intermediate frames between two images to get the appearance of the first image which develops into the second image.

Posted Date:- 2021-08-21 10:16:33

What are the uses of an embedded style sheet?

Embedded style sheet gives us the privilege to define styles in one place in an HTML document.

We can generate multiple classes using an embedded style sheet to use on multiple tag types of a web page and also there is no extra downloading required for importing the information.

<!DOCTYPE html>

<style type="text/css">
p {
font-family: georgia, serif;
font-size: x-large;
a:hover {
color: LimeGreen;
text-decoration: none;

<p>Embedded style sheet gives us the privilege to define styles at one place in a HTML document.
We can generate multiple classes using embedded style sheet to use on multiple tag types a web page
and also there is no extra downloading required importing the information.


Posted Date:- 2021-08-21 10:15:50

Cite different types of CSS.

There are three types of CSS as mentioned below:

External: These are written in separate files.
Internal: These are cited at the top of the web page code document.
Inline: These are written right next to the text.

Posted Date:- 2021-08-21 10:14:47

Distinguish between CSS2 and CSS3.

The differences between CSS2 and CSS3 are as follows:

1. CSS3 is divided into two various sections which are called a module. Whereas in CSS2 everything accedes into a single document with all the information in it.
2. CSS3 modules are supported almost on every browser and on the other hand modules of CSS and CSS2 are not supported in every browser.
3. CSS3 modules are supported almost on every browser and on the other hand modules of CSS and CSS2 are not supported in every browser.
4.In CSS3, a user can precise multiple background images on a webpage by using properties like background-image, background-position, and background-repeat styles.

Posted Date:- 2021-08-21 10:13:57

What are the different variations of CSS ?

The variations for CSS are:

CSS 2.1

Posted Date:- 2021-08-21 10:11:56

What is the origin of CSS ?

Standard Generalized Markup Language marked the beginning of style sheets in 1980s.

Posted Date:- 2021-08-21 10:10:47

What is CSS?

CSS outlines the style of an HTML webpage. It is a language by which we can set the behavior of an HTML webpage. It describes how the HTML content will be shown on screen.

Posted Date:- 2021-08-21 10:09:29

R4R Team
R4R provides CSS Freshers questions and answers (CSS Interview Questions and Answers) .The questions on R4R.in website is done by expert team! Mock Tests and Practice Papers for prepare yourself.. Mock Tests, Practice Papers,CSS fresher interview question ,CSS Freshers & Experienced Interview Questions and Answers,CSS Objetive choice questions and answers,CSS Multiple choice questions and answers,CSS objective, CSS questions , CSS answers,CSS MCQs questions and answers R4r provides Python,General knowledge(GK),Computer,PHP,SQL,Java,JSP,Android,CSS,Hibernate,Servlets,Spring etc Interview tips for Freshers and Experienced for CSS fresher interview questions ,CSS Experienced interview questions,CSS fresher interview questions and answers ,CSS Experienced interview questions and answers,tricky CSS queries for interview pdf,complex CSS for practice with answers,CSS for practice with answers You can search job and get offer latters by studing r4r.in .learn in easy ways .