• +91 9971497814
  • info@interviewmaterial.com

CSS Interview Questions Answers

Question 1 : How To Style Forms?

Answer 1 : Forms and form elements like SELECT, INPUT etc. can be styled with CSS - partially. Checkboxes and Radiobuttons do not yet accept styles, and Netscape 4.xx has certain issues, but here is a tutorial that explains the application of CSS Styles on Form Elements.

Question 2 : How far can CSS be taken beyond the web page--that is, have generalized or non-web specific features for such things as page formatting or type setting?

Answer 2 : Yes, it's possible to take CSS further in several directions. W3C just published a new Working Draft which describes features for printing, e.g., footnotes, cross-references, and even generated indexes. Another great opportunity for CSS is Web Applications. Just like documents, applications need to be styled and CSS is an intrinsic component of AJAX. The "AJAX" name sounds great.

Question 3 : As a reader, how can I make my browser recognize my own style sheet?

Answer 3 : Netscape It is not possible to do this in Netscape yet (as of version 4.0.) Internet Explorer 3.0 (Win95/NT) [It is possible to do this at least in Windows95/NT, but no user interface is provided. Unknown how this might be accomplished on other operating systems.] 1. Open the Registry editor (Start..Run..regedit..ENTER) 2. Under the 'HKEY_LOCAL_MACHINE\Software\Microsoft\InternetExplorer\Styles' key, Edit..New..String Value 3. The new value should be called 'StyleSheet Pathname' 4. For the value, type in the full directory path of your .css style sheet. Internet Explorer 4.0 (Win95/NT) 1. Under the View menu, select 'Internet Options'. 2. Under the 'General' tab, choose the 'Accessibility' button. 3. Choose the 'Format documents using my style sheet' check box and 'Browse...' to the location of your .css style sheet.

Question 4 : What is CLASS selector?

Answer 4 : Class selector is a "stand alone" class to which a specific style is declared. Using the CLASS attribute the declared style can then be associated with any HTML element. The class selectors are created by a period followed by the class's name. The name can contain characters a-z, A-Z, digits 0-9, period, hyphen, escaped characters, Unicode characters 161-255, as well as any Unicode character as a numeric code, however, they cannot start with a dash or a digit. (Note: in HTML the value of the CLASS attribute can contain more characters).It is a good practice to name classes according to their function than their appearance. .footnote {font: 70%} /* class as selector */ <ADDRESS CLASS=footnote/>This element is associated with the CLASS footnote</ADDRESS> <P CLASS=footnote>And so is this</P>

Question 5 : How To Style Table Cells?

Answer 5 : Margin, Border and Padding are difficult to apply to inline elements. Officially, the <TD> tag is a block level element because it can contain other block level elements (see Basics - Elements). If you need to set special margins, borders, or padding inside a table cell, then use this markup: <td> yourtext </div></td> to apply the CSS rules to the div inside the cell. </p>

Question 6 : What is CSS?

Answer 6 : 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 7 : What are Style Sheets?

Answer 7 : Style Sheets are templates, very similar to templates in desktop publishing applications, containing a collection of rules declared to various selectors (elements).

Question 8 : What is initial value?

Answer 8 : Initial value is a default value of the property, that is the value given to the root element of the document tree. All properties have an initial value. If no specific value is set and/or if a property is not inherited the initial value is used. For example the background property is not inherited, however, the background of the parent element shines through because the initial value of background property is transparent. <P style="background: red">Hello <strong>World </strong> </P> Content of the element P will also have red background

Question 9 : How do I quote font names in quoted values of the style attribute?

Answer 9 : The attribute values can contain both single quotes and double quotes as long as they come in matching pairs. If two pair of quotes are required include single quotes in double ones or vice versa: <P STYLE="font-family: 'New Times Roman'; font-size: 90%"> <P STYLE='font-family: "New Times Roman"; font-size: 90%'> It's been reported the latter method doesn't work very well in some browsers, therefore the first one should be used.

Question 10 : Why call the subtended angle a "pixel", instead of something else (e.g. "subangle")?

Answer 10 : In most cases, a CSS pixel will be equal to a device pixel. But, as you point out, the definition of a CSS pixel will sometimes be different. For example, on a laser printer, one CSS pixel can be equal to 3x3 device pixels to avoid printing illegibly small text and images. I don't recall anyone ever proposing another name for it. Subangle? Personally, I think most people would prefer the pragmatic "px" to the non-intuitive "sa".

CSS Contributors

krishan

Share your email for latest updates

Name:
Email:

Our partners