CSS interview questions and Answers
Cascading Style Sheets (CSS) is a style sheet language or a mechanism used for enhancing its style by adding colors, fonts, and spacing to your web documents. We have a collection of CSS interview questions that helps in crack your interviews. It is designed to enable the separation of content for improving content accessibility and providing more flexibility in the specification of presentation and reducing complexity in the structural content. The specifications of CSS are maintained and managed by the W3C.
Most Frequently Asked CSS interview questions
With the help of !important
we can override CSS properties.
.sidebar{
width:30%;
}
.sidebar{
width:40% !important;
}
It is an element which is used to style specified parts of an element. It can be used to either "Style the first letter, or line, of an element" or "Insert content before, or after, the content of an element".
Syntax :
selector::pseudo-element {
property:value;
}
There are three Types of CSS used to develop a web page.
- External css : These types of style sheets are having their separate files.
- Internal css : These types of styles are placed at the top of each web page document, in between head tag.
- Inline css : These types of styles are placed directly with HTML tags.
CSS3 is the latest version of CSS.
- It is Easy to maintain and update.
- It has Great consistency in design.
- It has more formatting options.
- It is Lightweight code.
- Faster downlad times.
- It has search engine optimization benefits.
There are 3 font attributes which is used to write CSS.
- color
- face
- size
- Bootstrap
- Semantic
- Materialize
- Bulma
- Foundation
- Pure CSS etc
It is used to select any type of elements in an HTML page. An asterisk ( * ) is used to denote a universal CSS selector. This is useful when we want to set a style for of all the elements of an HTML page.
Syntax : * { CSS-Property: value; ................. }
The float property in CSS places an element on the right or left side of its container, allowing text and inline elements to wrap around it.
.sidebar {
float: right;
width:30%;
}
Latest Version : CSS version 4 was released in March 2017.
Advantages
- Saves time
- Pages load quickly
- Easy to maintain
- Superior styles in HTML
- Compatible with multiple devices
Development History
CSS was proposed by Hakon Wium Lie in October 1994. The first released was made public in December 1996.