Home / Interview / CSS :: General Questions

Interview :: CSS

21)

What is the use of ruleset?

CSS syntax 

The ruleset is used to identify that selectors can be attached  with other selectors. It has two parts:

  • Selector - Selector indicates the HTML element you want to style.
  • Declaration Block - The declaration block can contain one or more declarations separated by a semicolon.

22) What is the difference between class selectors and id selectors?

An overall block is given to class selector while id selectors take only a single element differing from other elements.

CSS Class Selector

CSS Id Selector

23) What are the advantages of External Style Sheets?
  • You can create classes for reusing it in many documents.
  • By using it, you can control the styles of multiple documents from one file.
  • In complex situations, you can use selectors and grouping methods to apply styles.
24) What is the difference between inline, embedded and external style sheets?

Inline: Inline Style Sheet is used to style only a small piece of code.

Syntax

Embedded: Embedded style sheets are put between the ... tags.

Syntax

External: This is used to apply the style to all the pages within your website by changing just one style sheet.

Syntax

25) What is RWD?

RWD stands for Responsive Web Design. This technique is used to display the designed page perfectly on every screen size and device, for example, mobile, tablet, desktop and laptop. You don't need to create a different page for each device.

26) What are the benefits of CSS sprites?

If a web page has a large number of images that take a longer time to load because each image separately sends out an HTTP request. The concept of CSS sprites is used to reduce the loading time for a web page because it combines the various small images into one image. It reduces the number of HTTP requests and hence the loading time.

27) What is the difference between logical tags and physical tags?
  • Physical tags are referred to as presentational markup while logical tags are useless for appearances.
  • Physical tags are newer versions, on the other hand, logical tags are old and concentrate on content.
28) What is the CSS Box model and what are its elements?

The CSS box model is used to define the design and layout of elements of CSS.

The elements are:

  • Margin - It removes the area around the border. It is transparent.
  • Border - It represents the area around the padding
  • Padding - It removes the area around the content. It is transparent.
  • Content - It represents the content like text, images, etc.
CSS Box Model
29) What is the float property of CSS?

The CSS float property is used to move the image to the right or left along with the texts to be wrapped around it. It doesn't change the property of the elements used before it.

To understand its purpose and origin, let's take a look at its print display. In the print display, an image is set into the page such that text wraps around it as needed.

CSS Float Print Layout

Its web layout is also just similar to print layout.

CSS Float Web Layout
30) How to restore the default property value using CSS?

In short, there is no easy way to restore to default values to whatever a browser uses.

The closest option is to use the 'initial' property value, which restores the default CSS values, rather than the browser's default styles.