• +91 9971497814
  • info@interviewmaterial.com

Computer Interview Questions Answers

CSS Interview Questions Answers

Question - 81 : - How to customize your textboxes?

Answer - 81 : - Here is the code on how to do it: <style type="text/css"> <!-- BODY { scrollbar-arrow-color: green; scrollbar-face-color: #FFFFFF; scrollbar-track-color: rgb(12,35,244); } TEXTAREA { scrollbar-arrow-color: green; scrollbar-face-color: #FFFFFF; scrollbar-track-color: rgb(12,35,244); } // --> </style> That above code, has some similarities. The textbox area is treated with the same function statements as for the scrollbar. The scrollbar statements goes in the BODY selector.

Question - 82 : - How frustrating is it to write a specification knowing that you're at the browser vendors' mercy?

Answer - 82 : - That's part of the game. I don't think any specification has a birthright to be fully supported by all browsers. There should be healthy competition between different specifications. I believe simple, author-friendly specifications will prevail in this environment. Microformats are another way of developing new formats. Instead of having to convince browser vendors to support your favorite specification, microformats add semantics to HTML through the CLASS attribute. And style it with CSS.

Question - 83 : - What is CSS?

Answer - 83 : - 1. CSS stands for Cascading Style Sheets and is a simple styling language which allows attaching style to HTML elements. Every element type as well as every occurrence of a specific element within that type can be declared an unique style, e.g. margins, positioning, color or size. 2. CSS is a web standard that describes style for XML/HTML documents. 3. CSS is a language that adds style (colors, images, borders, margins…) to your site. It’s really that simple. CSS is not used to put any content on your site, it’s just there to take the content you have and make it pretty. First thing you do is link a CSS-file to your HTML document. Do this by adding this line: <link rel="stylesheet" href="style.css" type="text/css"> The line should be placed in between your <head> and </head> tags. If you have several pages you could add the exact same line to all of them and they will all use the same stylesheet, but more about that later. Let’s look inside the file “style.css” we just linked to. h1 { font-size: 40px; height: 200px; } .warning { color: Red; font-weight: bold; } #footer { background-color: Gray; } 4. Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g. fonts, colors, spacing) to Web documents. This is also where information meets the artistic abilities of a web-designer. CSS helps you spice up your web-page and make it look neat in wide variety of aspects.

Question - 84 : - What is 'important' declaration?

Answer - 84 : - Important declaration is a declaration with increased weight. Declaration with increased weight will override declarations with normal weight. If both reader's and author's style sheet contain statements with important declarations the author's declaration will override the reader's. BODY {background: white ! important; color: black} In the example above the background property has increased weight while the color property has normal.

Question - 85 : - Must I quote property values?

Answer - 85 : - Generally no. However, values containing white spaces, e.g. font-family names should be quoted as whitespaces surrounding the font name are ignored and whitespaces inside the font name are converted to a single space, thus font names made up of more than one word (e.g.) 'Times New Roman' are interpreted as three different names: Times, New and Roman. Do any WYSIWYG editors support the creation of Style Sheets? Any text-based HTML editors? As support for CSS in browsers has matured in the last year, both WYSIWYG and Text-based HTML editors have appeared that allow the creation or the assistance of creating Cascading Style Sheet syntax. There are now at least two dozen editors supporting CSS syntax in some form. The W3C maintains an up-to-date list of these WYSIWYG and text-based editors.

Question - 86 : - To what are partial URLs relative?

Answer - 86 : - Partial URLs are relative to the source of the style sheet. The style sheet source can either be linked or embedded. To which source partial URLs are relative to depends on their occurrence. If a partial URL occurs in a linked style sheet then it is relative to the linked style sheet. The URL of the linked style sheet is the URL of the directory where the sheet is kept. If a partial URL occurs in an embedded style sheet then it is relative to the embedded style sheet. The URL of the embedded style sheet is the URL of the HTML document in which the sheet is embedded. Note that Navigator 4.x treats partial URLs as being relative to the HTML document, regardless of the place where the partial URL occurs. This is a serious bug which forces most authors to use absolute URLs in their CSS.

Question - 87 : - How do I design for backward compatibility using Style Sheets?

Answer - 87 : - Existing HTML style methods (such as <font SIZE> and <b>) may be easily combined with style sheet specification methods. Browsers that do not understand style sheets will use the older HTML formatting methods, and style sheets specifications can control the appearance of these elements in browsers that support CSS1.

Question - 88 : - Why do style sheets exist?

Answer - 88 : - SGML (of which HTML is a derivative) was meant to be a device-independent method for conveying a document's structural and semantic content (its meaning.) It was never meant to convey physical formatting information. HTML has crossed this line and now contains many elements and attributes which specify visual style and formatting information. One of the main reasons for style sheets is to stop the creation of new HTML physical formatting constructs and once again separate style information from document content.

Question - 89 : - How do you target a certain browser?

Answer - 89 : - IE can be targetted by preceding your properties with '* html'. For example... #nav { position:fixed; } * html #nav { /* this will target IE */ position:absolute; } Another way to target IE is with conditional comments. Put this (below) in the head - just before the closing tag - and put anything you want to be directed only at IE in another stylesheet. <!--[if IE]> <link href="ieonly.css" rel="stylesheet" type="text/css"> <![endif]--> If you need to target IE5x... #wrap { width:760px; /* for IE5x */ w\idth:780px; /* for all other major browsers */ }

Question - 90 : - How to make text-links without underline?

Answer - 90 : - a:link, a:visited {text-decoration: none} or <a style="text-decoration: none" HREF="..."> ...will show the links without underlining. However, suppressing the underlining of links isn't a very smart idea as most people are used to having them underlined. Also, such links are not spotted unless someone coincidentally runs a mouse over them. If, for whatever reason, links without underline are required background and foreground colors can be instead declared to them so that they can be distinguished from other text, e.g.; a:link, a:visited {text-decoration: none; background: red; color: blue} or <a style="text-decoration: none; background: red; color: blue" HREF="..."> Both background and foreground colors should be specified as the property that is not specified can be overridden by user's own settings.

Computer Contributors

Rajeev Katiyar
Yes Baroda

Share your email for latest updates


Our partners