Given below are the 8 best CSS interview questions and answers.
- Name all the modules which are used in the current version of CSS.
Answer: The list of several modules in CSS is as given below.
Backgrounds and borders
Multiple column layouts
- Define use of embedded style sheet?
Answer: Embedded style sheet provides us the privilege to define styles at one place in an HTML document.
We can generate multiple classes using an embedded style sheet using on multiple tag types of a web page and also there is no extra downloading required for importing the information.
- Differentiate between CSS2 and CSS3.
Answer: The differences between CSS2 and CSS3 are:
- CSS3 modules are supported by almost every browser but all browsers do not support modules of CSS and CSS2.
- Many graphics related characteristics have been introduced such as flexbox, box-shadow and border-radius in CSS3.
- Multiple background images on a webpage can be precise by a user with properties like background-image, background-position along with background repeat styles in CSS3.
- CSS3 is divided into two various sections called as a module, but in CSS2 everything accedes into a single document with all the information in it.
- Explain the term Responsive web design.
Answer: It is a method of designing and developing a web page according to the user activities and conditions based on various components like portability of the web page on different device, the size of the screen and etc. done by using different flexible layouts and grids.
- Explain the concept of Tweening.
Answer: It is a process in which we can create intermediate frames between two images to get the appearance of the first image which develops into the second image and generally used for creating animations.
- How do we make a rounded corner by using CSS?
Answer: rounded corner can be created only by using the property “border-radius”. We can apply this property to any element.
Example as follows:
<h1>The border-radius Property</h1>
<p>Rounded corners for an element with a specified background color:</p>
<p id=”rcorners1″>Rounded corners!</p>
- What is the difference between padding and margin?
Answer: In CSS, the margin is considered as the property by which we can create space around elements. We can create space to the exterior defined borders. In CSS we have margin property which is as follows:
- What is the use of the Box Model in CSS?
Answer: The box model is a box that binds all the HTML elements including different features like margins, border, and padding along with the actual content. By using box model we get authority to add the borders all around the elements and also able to define the space between the elements.