• +91 9971497814
  • info@interviewmaterial.com

Computer Interview Questions Answers

CSS Interview Questions Answers

Question - 91 : - How do I place text over an image?

Answer - 91 : - To place text or image over an image you use the position property. The below exemple is supported by IE 4.0. All you have to do is adapt the units to your need. <div style="position: relative; width: 200px; height: 100px"> <div style="position: absolute; top: 0; left: 0; width: 200px"> <image> </div> <div style="position: absolute; top: 20%; left: 20%; width: 200px"> Text that nicely wraps </div> </div>

Question - 92 : - How do I combine multiple sheets into one?

Answer - 92 : - To combine multiple/partial style sheets into one set the TITLE attribute taking one and the same value to the LINK element. The combined style will apply as a preferred style, e.g.: <LINK REL=Stylesheet HREF="default.css" TITLE="combined"> <LINK REL=Stylesheet HREF="fonts.css" TITLE="combined"> <LINK REL=Stylesheet HREF="tables.css" TITLE="combined">

Question - 93 : - What are Style Sheets?

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

Question - 94 : - What is embedded style? How to link?

Answer - 94 : - Embedded style is the style attached to one specific document. The style information is specified as a content of the STYLE element inside the HEAD element and will apply to the entire document. <HEAD> <STYLE TYPE="text/css"> <!-- P {text-indent: 10pt} --> </STYLE> </HEAD> Note: The styling rules are written as a HTML comment, that is, between <!-- and --> to hide the content in browsers without CSS support which would otherwise be displayed.

Question - 95 : - What is cascade?

Answer - 95 : - Cascade is a method of defining the weight (importance) of individual styling rules thus allowing conflicting rules to be sorted out should such rules apply to the same selector. Declarations with increased weight take precedence over declaration with normal weight: P {color: white ! important} /* increased weight */ P (color: black} /* normal weight */ Are Style Sheets case sensitive? No. Style sheets are case insensitive. Whatever is case insensitive in HTML is also case insensitive in CSS. However, parts that are not under control of CSS like font family names and URLs can be case sensitive - IMAGE.gif and image.gif is not the same file.  

Question - 96 : - How do I place two paragraphs next to each other?

Answer - 96 : - There are several ways to accomplish this effect, although each has its own benefits and drawbacks. We start with the simplest method of positioning two paragraphs next to each other. <DIV style="float: left; width: 50%">Paragraph 1</DIV> <DIV style="float: left; width: 50%">Paragraph 2</DIV> Trickier is this example, which relies on positioning but does not suffer the vertical-overlap problems which plague many other positioning solutions. The problem is that it relies on an incorrect positioning implementation, and will break down dramatically in conformant browsers. <P> <SPAN STYLE="position: relative; left: 50%; width: 50%"> <SPAN STYLE="position: absolute; left: -100%; width: 100%"> Paragraph 1</SPAN> Paragraph 2</SPAN> </P> If floating is not sufficient to your purposes, or you cannot accept display variances in older browsers, then it may be best to fall back to table-based solutions.

Question - 97 : - Document Style Semantics and Specification Language (DSSSL)?

Answer - 97 : - Document Style Semantics and Specification Language is an international standard, an expression language, a styling language for associating processing (formatting and transformation) with SGML documents, for example XML.

Question - 98 : - How do I centre my page?

Answer - 98 : - This is very easy. If we take the code in the last question and change it to this : CSS body, html { height:100%; } body { margin:0; padding:0; } #wrap { position:relative; width:780px; margin:auto; min-height:100%; } * html #wrap { height:100%; } you get a page that fits an 800x600 resolution screen without a horizontal scrollbar, which will be centered at higher resolutions.

Question - 99 : - Is CSS case sensitive?

Answer - 99 : - Cascading Style Sheets (CSS) is not case sensitive. However, font families, URLs to images, and other direct references with the style sheet may be. The trick is that if you write a document using an XML declaration and an XHTML doctype, then the CSS class names will be case sensitive for some browsers. It is a good idea to avoid naming classes where the only difference is the case, for example: div.myclass { ...} div.myClass { ... } If the DOCTYPE or XML declaration is ever removed from your pages, even by mistake, the last instance of the style will be used, regardless of case.

Question - 100 : - What is shorthand property?

Answer - 100 : - Shorthand property is a property made up of individual properties that have a common "addressee". For example properties: font-weight, font-style, font-variant, font-size, font-family, refer to the font. To reduce the size of style sheets and also save some keystrokes as well as bandwidth they can all be specified as one shorthand property font, e.g.: H1 {font-weight: bold; font-style: italic; font-variant: small-caps; font-size: 160%; font-family: serif} can be all shorthanded to a space separated list: H1 {font: bold italic small-caps 160% serif} Note: To make things even simpler the line-height property can be specified together with the font-size property: H1 {font: bold italic small-caps 160%/170% serif} How to use CSS building a standards based HTML template? It should: 1. Contain: header, navigation, content, footer 2. Use well-structured HTML 3. Be error-free and encourage good coding Let’s start with number one there: HTML document split up in four parts all with different meaning, use the -tag. Div is short for “division” and isn’t header, navigation and so on ... !DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Your own page title</title> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body> <div id="header"> <h1>The name of this page</h1> </div> <div id="navigation"> <h2>Navigation</h2> <ul> <li><a href="first.html">First</a></li> <li><a href="second.html">Second</a></li> <li><a href="third.html">Third</a></li> </ul> </div> <div id="

Computer Contributors

krishan
Rajeev Katiyar
Yes Baroda

Share your email for latest updates

Name:
Email:

Our partners