CSS Questions

What is CSS?
CSS - Cascading Style Sheet is used to design web page with various style properties.
What are the levels of CSS or in how many ways we apply styles?
  • Inline CSS
  • Internal or Embedded CSS
  • External CSS
What are the advantages of CSS?
  • Faster loading time
  • Responsive design
  • Applying animations and effects
  • Print friendly pages
What is meant by selector?
Selectors are used to find or select a HTML element that you want to style.
What are the types of selector?
Some of the selector types:
  • Universal selector
  • Element selector
  • id selector
  • class selector
  • Group selector
What is the use of background property?
Background property is used to set background color or to set background image and control it.
How to remove underline for hyperlink text?
By using style text-decoration: none
What is the use of margin property?
Margin property used to create space around element.
What is the use of padding property?
Padding property used to create space around element’s content.
What is the use of border property?
Border property is used to set style, width and color of element’s border.
What is box-model?
Box model is a container that contains multiple properties including margin, border, padding and content.
What is display property?
Display property is used to specify how an element is shown on a web page like never display element (none), display element as inline or display element as block.
Difference between block, inline and inline-block of display property?
inline: The element doesn’t start on a new line and only occupy just the width it requires. You can’t set the width or height.
block: The element will start on a new line and occupy the full width available. And you can set width and height values.
inline-block: It’s formatted just like the inline element, where it doesn’t start on a new line. BUT, you can set width and height values.
What are pseudo-classes?
Pseudo-classes are special state of applying style when mouseover, visited or unvisited links etc.
What are pseudo-elements?
Pseudo-elements are used to apply styles to the part of element that is first-line of element content, before or after the content etc.
What is !important?
!important rule is used to add importance to property when override in different levels.
Explain about CSS media queries?
Media queries are used to check device resolution and display the content accordingly.
What is responsive design?
A responsive design is automatically adjust its content according to viewports.
How to import external CSS into HTML?
<link rel="stylesheet" href="filename.css" />
How to import CSS file into another CSS file?
@import url(path of css file);