• +91 9971497814
  • info@interviewmaterial.com

Computer Interview Questions Answers

CSS Interview Questions Answers

Question - 51 : - What does the "Cascading" in "Cascading Style Sheets" mean?

Answer - 51 : - Style Sheets allow style information to be specified from many locations. Multiple (partial) external style sheets can be referenced to reduce redundancy, and both authors as well as readers can specify style preferences. In addition, three main methods can be employed by an author to add style information to HTML documents, and multiple approaches for style control are available in each of these methods. In the end, style can be specified for a single element using any, or all, of these methods. What style is to be used when there is a direct conflict between style specifications for an element? Cascading comes to the rescue. A document can have styles specified using all of these methods, but all the information will be reduced to a single, cohesive "virtual" Style Sheet. Conflict resolution is based on each style rule having an assigned weight according to its importance in the scheme of things. A rule with a higher overall importance will carry a higher weight. This will be used in place of a competing style rule with a lower weight/importance. A hierarchy of competing styles is thus formed creating a "cascade" of styles according to their assigned weights. The algorithm used to determine this cascading weight scale is fairly complex.

Question - 52 : - Which style specification method should be used? Why?

Answer - 52 : - The answer to this one is tricky. The short answer is: "it depends." The long answer is, however, another story. If you are planning on using more than one style specification method in your document, you must also worry about Cascading Order of Style methods (see question 11.) If you are going to use only one method, then some guidelines about the nature of each method need to be kept in mind. The answer to this question is also very much related to the advantages and disadvantages to using each of them (next question.) Method 1: External Style Sheets (The LINK [-->Index DOT Html] element) This method should be used if you want to apply the same style to multiple documents. Each document can reference the stand-alone style sheet and use the styles contained within. Using this method, the appearance of many documents can be controlled using a single or small number of style sheets. This can save a LOT of time for an author. Method 2: Embedded Style Sheets (The Style [-->Index DOT Html] element) The syntax used with Method 2 is the same as that for Method 1. This method is a happy medium between External Style Sheets and Inline Styles (see below.). It should be used in place of Method 1 if you only want to specify styles for a single document. This method should also be used when you want to specify a style for multiple tag types at once or the list of style definitions is of larger size. Method 3: Inline Styles (STYLE attribute to HTML elements) If you only have to apply style to one or a few elements in a single document, your best bet will often be an Inline Style. This method attaches a style definition within the HTML element it is modifying. Justified Text? You redefine the <p> tag like: p {text-align: justify;} and that renders all <p>s with justified text. Another possibility is to define a class, like: .just {text-align: justify;} and then you style the paragraphs in question like: <td class="just">text </td> Note that NN 4.xx has problems with the inheri

Question - 53 : - How To Style Forms?

Answer - 53 : - 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 - 54 : - What is Extensible Stylesheet Language (XSL)?

Answer - 54 : - XSL is a proposed styling language for formatting XML (eXtensible Markup Language) documents. The proposal was submitted to the W3C by Microsoft, Inso, and ArborText.

Question - 55 : - What is parent-child selector?

Answer - 55 : - Parent-child selector is a selector representing the direct descendent of a parent element. Parent-child selectors are created by listing two or more tilde (~) separated selectors. BODY ~ P {background: red; color: white} The P element will be declared the specified style only if it directly descends from the BODY element: <BODY> <P>Red and white paragraph </P> </BODY> BODY ~ P ~ EM {background: red; color: white} The EM element will be declared the specified style only if it directly descends from the P element which in its turn directly descends from the BODY element: < <P> <EM>Red and white EM </EM> </P> </BODY>

Question - 56 : - Why does my content shift to the left on some pages (in FF)?

Answer - 56 : - That'll be the pages with more content? The ones that have a vertical scrollbar? If you look in IE there's probably a white space on the right where there would be a scrollbar if there were enough content to require one. In Firefox, the scrollbar appears when it's needed and the viewport becomes about 20px smaller, so the content seems to shift to the left when you move from a page with little content to one with lots of content. It's not a bug or something that needs to be fixed, but it does confuse and irritate some developers. If, for some reason, you'd like Firefox to always have scrollbars - whether they're needed or not - you can do this : CSS html { height:100.1%; }

Question - 57 : - Which set of definitions, HTML attributes or CSS properties, take precedence?

Answer - 57 : - CSS properties take precedence over HTML attributes. If both are specified, HTML attributes will be displayed in browsers without CSS support but won't have any effect in browsers with CSS support.

Question - 58 : - What is the percentage value in 'font-size' relative to?

Answer - 58 : - It is relative to the parent element's font-size. For example, if the style sheet says: H1 {font-size: 20pt;} SUP {font-size: 80%;} ...then a <SUP> inside an <H1> will have a font-size of 80% times 20pt, or 16pt.

Question - 59 : - Can you use someone else's Style Sheet without permission?

Answer - 59 : - This is a somewhat fuzzy issue. As with HTML tags, style sheet information is given using a special language syntax. Use of the language is not copyrighted, and the syntax itself does not convey any content - only rendering information. It is not a great idea to reference an external style sheet on someone else's server. Doing this is like referencing an in-line image from someone else's server in your HTML document. This can end up overloading a server if too many pages all over the net reference the same item. It can't hurt to contact the author of a style sheet, if known, to discuss using the style sheet, but this may not be possible. In any case, a local copy should be created and used instead of referencing a remote copy. I want my page fonts to look the same everywhere as in… a) Why are my font sizes different in different browsers ? b) Why are my font sizes different on different platforms ? These questions represent the tip of the iceberg of a large topic about which whole essays have been written and a wide range of different views are held. The WWW was originally devised to present the same content in different presentation situations and for a wide range of readers: on that basis, "looking the same" is not a design criterion, indeed different presentations would be expected to look different. Some would have it that this original aim is no longer relevant, and that the purpose of web design is now to factor out the differences between display situations and put the author in control of the details of the presentation. Others point out that CSS was designed to give the reader a substantial amount of joint control over this process, and that this is desirable, for example to accommodate users with different visual acuity. Reading of textual matter on a computer screen is quite a delicate business, what with the relatively coarse pixel structure of a computer display; even with a close knowledge of the display details, it isn't possible to achieve the detailed control that would be possible, say, on a printer. Whatever one's aims, the practical truth is that many of the efforts made to guarantee the precise result on the screen have seriously counterproductive side effects in a www situation. The CSS specifications themselves recommend that authors should not use absolute size units in a situation where the properti

Question - 60 : - Do URL's have quotes or not?

Answer - 60 : - Double or single quotes in URLs are optional. The tree following examples are equally valid: BODY {background: url(pics/wave.png) blue} BODY {background: url("pics/wave.png") blue} BODY {background: url('pics/wave.png') blue}

Computer Contributors

krishan
Rajeev Katiyar
Yes Baroda

Share your email for latest updates

Name:
Email:

Our partners