Sunday, January 25, 2015

Nitheen Kumar

CSS Interview Questions and Answers

 
Cascading Style Sheets (CSS) is a style sheet language used for describing the look and formatting of a document written in a markup language. While most often used to change the style of web pages and user interfaces written in HTML and XHTML, Before you continue you should have a basic understanding of the following: HTML / XHTML

What is CSS?

CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles were added to HTML 4.0 to solve a problem External Style Sheets can save a lot of work External Style Sheets are stored in CSS files

1. What are cascading style sheets?

Cascading style sheets help the designer in various ways. It primarily helps to design style sheets for content and HTML pages. It can be applied to any XML document or mark up language.

2. Explain about some of the features of CSS.?

Some of the features used by CSS are to define a layout, colors, fonts, etc. It separates the content from the design part which makes the content much more visible thereby improving productivity of the entire process. It can make the same page appear in different formats.

3. Explain about the rules present in style sheets.?

A huge list of rules is defined for style sheets. Each rule consists of selectors and declaration block. A declaration block consists of declarations which can be defined and separated by using a semicolon within curly braces. Also each declaration consists of a colon, a property and a semicolon.

4. Explain about the hover element.?

A hover element is activated when the user moves a pointer over the area where HTML coding is defined. This style is being extensively used for online advertising. It is appended to #elementid:hover.

5. State some of the uses of CSS.?

CSS offers many possibilities to a designer and developer. Some of them are Moving of the entire style sheet coding to a separate external folder. Repetition and code reuse features make CSS rich. Presentation and structure are made different by CSS etc.

6. State the different type of author styles.?

A web page author, developer, designer, etc can describe styles in three different forms they are External style sheets Embedded style Inline styles Local and default style sheet. A default style sheet consists of the style imparted by the browser which the user is accessing for the information.

7. What are the main goals of applying style sheets?

The main use of style sheet is to give the user a greater degree of control over his presentation. If the user does not like a certain font he can change it with flexibility without any difficulty. Also a developer can minimize the effects which a browser can have on the application or the text part of the webpage. Control over the entire web page without any external influences, separation of the page from the HTML code part.

8. Explain about CSS1.?

W3C recommended adoption of CSS1in 1996. Some of the capabilities and features present in CSS1 are as follows. Font properties Background colors, text colors, etc Spacing between text, words, etc Tables, images alignment Border, margin, padding and positioning of elements Attributes are uniquely identified and classified generically. W3C still adopts the specifications put forwarded in CSS1.

9. What are the additional features which were present in CSS2 compared to CSS1?

Many of the new features were present in CSS2 some of them are as follows. Positioning of elements will be according to the relative, fixed and the absolute positioning. Inclusion of large number of media functions. Shadows, bidirectional support for text and aural style sheets.

10. Explain about CSS filter.?

CSS filter solves designers and coders difficulties. With the help of these filters one can write entirely different code or modify the existing design patterns so that browsers receive CSS specifications which they support, thereby not allowing the browsers to make or create any unnecessary changes.

11. Explain about Internet explorer box model bug.?

Designers had a very tough time dealing with this bug, because it will not display box widths appropriately on the webpage. It displayed the block to be narrow in size. This bug can be rectified by using CSS filter and hacks. Also correct usage and documentation of XHTML can solve the problems.

12. Explain about vertical control limitation.?

Vertical control limitations are always a nightmare for a designer. Horizontal positioning of text or element is always easy but vertically positioning an element always leads to convoluted and impossible tasks. CSS has unsupported rules for vertical placement of elements.

13. Explain about absence of expressions.?

CSS currently does not have the ability to specify property values as simple expressions. For example if you want to calculate the size of all the columns but you have a restriction on the sum of all columns. This problem has been solved by many browsers by proprietary expressions which did the job well.

14. Explain about lack of orthogonality.?

Lack of orthogonality explains about the various multiple jobs which are either undefined correctly for a specific application or used multiple times for the same job. CSS defines that internal elements of a table will not have margins so usage of border spacing is appropriate which leads to confusion.

15. Explain about the ease of maintenance with CSS.?

An effective style sheet has effective use of inheritance and cascading style sheets. When changes are applied to a single element of this global style sheet every element of the web page changes. This made the maintenance easy because here we can change the style of the whole page by effecting a change to a single element.

16. Explain about float containment.?

CSS does not support float elements as it can cause overflow of the elements. Floats also tend to vary according to the web browser resolution and size but positions do not. There are some multiple properties which can define about float but they have their own limitations.

17. State some limitations of style sheets.?

Style sheets do have its own share of limitations some of them are as follows:- Inconsistent browser support Vertical control limitations Margin collapsing, float containment, control of element shapes, etc Lack of column declaration and variables are some of the limitations present in CSS.

18. What are CSS frameworks?

It is a pre-planned libraries, which allows easier and more standards-compliant webpage styling, using CSS language.

19. In how many ways can a CSS be integrated as a web page?

CSS can be integrated in three ways: Inline: Style attribute can be used to have CSS applied HTML elements. Embedded: The Head element can have a Style element within which the code can be placed. Linked/ Imported: CSS can be placed in an external file and linked via link element.

20. What benefits and demerits do External Style Sheets have?

Benefits: One file can be used to control multiple documents having different styles. Multiple HTML elements can have many documents, which can have classes. To group styles in composite situations, methods as selector and grouping are used. Demerits: Extra download is needed to import documents having style information. To render the document, the external style sheet should be loaded. Not practical for small style definitions.

21. Discuss the merits and demerits of Embedded Style Sheets?

Merits: Multiple tag types can be created in a single document. Styles, in complex situations, can be applied by using Selector and Grouping methods. Extra download is unnecessary. Demerits: Multiple documents cannot be controlled.

22. What does CSS selector mean?

A string equivalent of HTML elements by which declarations or a set of it, is declared and is a link that can be referred for linking HTML and Style sheet is CSS selector.

23. Enlist the media types CSS allows?

The design and customization of documents are rendered by media. By applying media control over the external style sheets, they can be retrieved and used by loading it from the network.

24. Differentiate logical tags from physical tags?

While physical tags are also referred to as presentational mark-up, logical tags are useless for appearances. Physical tags are newer versions while logical tags are old and concentrate on content.

25. Differentiate Style Sheet concept from HTML?

While HTML provides easy structure method, it lacks styling, unlike Style sheets. Moreover, style sheets have better browser capabilities and formatting options.

Subscribe to get more Posts :