InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What are difference between class selector and ID selector? |
|
Answer» In CSS, a Class SELECTOR is a NAME PRECEDED by a full STOP (".") and an ID selector is a name preceded by a hash("#"). Difference between an ID and a class is that an ID can be USED to identify one element, whereas a class can be used to identify more than one. |
|
| 3. |
Explain the following common CSS units of length: cm, em, in, mm, pc, pt, and px. |
| Answer» | |
| 4. |
What is the use of sprites in CSS? |
|
Answer» It is a collection of images put into a single image. A page with many images can take a long time to load and generates MULTIPLE SERVER requests. Using sprites will REDUCE the NUMBER of server requests and save bandwidth. |
|
| 5. |
What are the difference between margin & padding? |
|
Answer» Margin is a OUTER SPACE of an element but padding is the INNER space of an element. In other words we can SAY margin is the space outside of an element's BORDER but padding is the space inside of its border. |
|
| 6. |
What is the used of !important? How we can use it? |
|
Answer» The !important css RULE is used for overriding the previously assigned CSS declarations. Also Read: DIFFERENCE between HTML and HTML5Example#SIDEBAR { |
|
| 7. |
What is responsive? |
|
Answer» It is about making a WEBSITE look good on all devices like desktops, tablets, and phones ETC. In responsive HTML and CSS is automatically RESIZE a website. |
|
| 8. |
How to write css for 3rd child of every tags? |
|
Answer» nth-CHILD(n) : It matches EVERY element that is the nth child, regardless of type, of its parent. Exampleul:nth-child(3) {
|
|
| 9. |
What are the difference between Internal & External CSS? |
|
Answer» INTERNAL CSS are the ones that we can WRITE within the same FILE i.e the HTML code and CSS code are placed in the same file. External CSS are that we can write in a SEPARATE file than the html code i.e the HTML file is separate like(index.html) and CSS file is separate like(style.css). |
|
| 10. |
What are the difference between "position:absolute" & "position:relative" in CSS? |
|
Answer» Both Postions(absolute & relative) are having different features. Once we SET Position then you can able to use top, RIGHT, bottom, left attributes. An absolute position element is positioned relative to the FIRST parent element that has a position other than static. Absolute : In case of position absolute, an element searches for the nearest available coordinate AXES AMONG its parent elements. The element is then positioned by specifying offsets from this co-ordinates axis. It removed from document normal flow. Relative : In case of position relative, an element creates its own co-ordinates axes, at a location offset from the view port co-ordinate axis. It is Part of document flow but shifted. |
|
| 11. |
What is the limitations of CSS? |
|
Answer» CSS has various limitations as a PROGRAMMING language thats are as follows:
|
|
| 12. |
How to make scroll bars with the help of CSS? |
|
Answer» The CSS overflow PROPERTY specifies whether to clip CONTENT or to add scrollbars when the content of an element is too BIG to fit in a SPECIFIED area. Property of overflow is given below :-
overflow: scroll overflow-x and overflow-y |
|
| 13. |
What are the difference between "display:none" and "visibility:hidden" in CSS? |
|
Answer» VISIBILITY:hidden : Ithides an element, but it will STILL take up the same space as before. The element will be hidden, but still, affect the layout. display:none : It HIDES an element as well as doesn't PRESERVE the space. |
|
| 14. |
What is the use of z-index in CSS? |
|
Answer» It specifies the STACK order of an element. An element with GREATER stack order is always in front of an element with a lower stack order. z-index only works on positioned elements like position:ABSOLUTE, position:relative, or position:FIXED. |
|
| 15. |
What is hover effect in css? How we can apply on tags? |
|
Answer» It select and style a link when you MOUSE over it. An :hover is used to select ELEMENTS when you mouse over them. Examplea:hover{ |
|
| 16. |
What is float in CSS? |
|
Answer» 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. Example.sidebar { |
|
| 17. |
What is universal css selector? |
|
Answer» 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; ................. } Also READ: What are the Latest Features in Bootstrap 4 |
|
| 19. |
What are the different font attributes? |
|
Answer» There are 3 FONT ATTRIBUTES which is USED to WRITE CSS.
|
|
| 20. |
What are advantages of CSS? |
Answer»
|
|
| 22. |
How many types of CSS? |
| Answer» Also Read: HTML5 Interview Questions and Answers | |
| 23. |
What is the purpose of pseudo elements? |
|
Answer» 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 : |
|
| 24. |
What is the meaning of parent-child selector? |
| Answer» | |
| 25. |
How we can override CSS? |
|
Answer» With the HELP of !IMPORTANT we can OVERRIDE CSS properties. Example.SIDEBAR{ |
|
| 26. |
What are Advantages of CSS3 over CSS? |
|
Answer» CSS3 is a new version of CSS that have various BENEFITS from technical features and properties. From better maintenance, loading speed, and LAYOUT DESIGN properties CSS3 is much more versatile than CSS. Designers can USE all these property in a simpler manner. |
|
| 27. |
What is attributes in CSS and how they used? |
|
Answer» It is used to select elements with a specified ATTRIBUTE. It is POSSIBLE to add CSS that have specific attributes or attribute values. It is used to select elements with an attribute VALUE containing a specified word. Examplea[href="#"] { |
|
| 28. |
Explain the difference between CSS2 & CSS3? |
|
Answer» CSS2 : It was released in 1998. In CSS2 designers could only use web safe fonts for being 100% sure to use fonts that would always display the same on every system. CSS2 had "simple SELECTORS". In CSS2, the developers or designers had difficulty because the STANDARD was not EQUIPPED with automatically breaking of the text so that it FITS within a box. CSS3 : It was released in 1999. In CSS3 designers can use special fonts like those available in GOOGLE Fonts and Typecast. CSS3 calls the components as "a sequence of simple selectors". In CSS3 has the capability to split text sections into multiple columns so that it can be read as a newspaper. |
|
| 29. |
What is the use of @import? |
|
Answer» @media can be used in media query to apply DIFFERENT styles for different media TYPES or devices. It can be used to CHECK many things, such as width and height of the view PORT. |
|
| 30. |
What is CSS Box Model and also explain its elements? |
|
Answer» CSS BOX MODEL is used when talking about design and layout. It is ESSENTIALLY a box that wraps around every HTML element. It consists of margins, borders, padding, and the actual content. Elements of CSS Box Model
|
|
| 31. |
How to write media query for mobiles? |
|
Answer» In between @MEDIA screen and (max-width: 600px) { and } we can write our CSS. It can directly EFFECT for mobile device. |
|
| 32. |
What are the difference between Inline CSS & Internal CSS? |
|
Answer» CSS can be applied to our website's HTML files in various ways. We can USE an external css, an internal css, or an inline css. Inline CSS : It can be applied on directly on html tags. Priority of inline css is GREATER than inline css. Internal CSS : It can be applied in web PAGE in top of the page between heading TAG. It can be start WITHTAG. Priority of internal css is less than inline css. Related Article: Tips to crack CSS Interviews |
|