CSS Interview Questions and Answers
Question - 21 : - What is a Style Sheet?
Answer - 21 : - Style sheets are the way that standards-compliant Web designers define the layout, look-and-feel, and design of their pages. They are called Cascading Style Sheets or CSS. With style sheets, a designer can define many aspects of a Web page:
* fonts
* colors
* layout
* positioning
* imagery
* accessibility
Style sheets give you a lot of power to define how your pages will look. And another great thing about them is that style sheets make it really easy to update your pages when you want to make a new design. Simply load in a new style sheet onto your pages and you're done.
Question - 22 : - What is alternate Style Sheet? How to link?
Answer - 22 : - Alternate Style Sheet is a sheet defining an alternate style to be used in place of style(s) declared as persistent and/or preferred .
Persistent style is a default style that applies when style sheets are enabled but can disabled in favor of an alternate style, e.g.:
Preferred style is a default style that applies automatically and is declared by setting the TITLE attribute to the LINK element. There can only be one preferred style, e.g.:
Alternate style gives an user the choice of selecting an alternative style - a very convenient way of specifying a media dependent style. Note: Each group of alternate styles must have unique TITLE, e.g.:
Alternate stylesheet are not yet supported.
Question - 23 : - How can you set a minimum width for IE?
Answer - 23 : - To set a minimum width, the CSS property is 'min-width'. This can be very useful and works well in good browsers. IE doesn't understand 'min-width'. However, it has a proprietary property called 'expression' which allows us to feed it javascript via a stylesheet. Below is how to set a (780px) minimum width for IE...
As the property is non-standard, it won't validate with the W3C validator, so if we put it in the head like this (above) - in an IE conditional comment - the validator will ignore it and the page will get a clean bill of health.
Question - 24 : - Which browsers support CSS?
Answer - 24 : - It depends on your definition of "support." If you are interested in those browsers which makes some attempt at supporting CSS, no matter how partial or bug-ridden, then the list is:
* Internet Explorer 3.0 and above
* Navigator 4.0 and above
* Opera 3.6 and above
* Konqueror
* Arena
* Emacs-w3
* Amaya
* Lexicon
* XPublish by Media Design in·Progress
If instead you're interested in those browsers which are known to do a credible job of bug-free and mostly completel support for CSS1, then the list narrows somewhat dramatically:
* Internet Explorer 5.0 for Macintosh and above
* Internet Exporer 5.5 for Windows and above
* Netscape Navigator 6.0 and above
* Opera 4.0 and above
While none of these browser can be claimed to have a perfect implementation of CSS1, they are all quite good and can be relied upon to operate in a consistent fashion for most of CSS1.
Question - 25 : - How do I place text over an image?
Answer - 25 : - 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.
Question - 26 : - what CSS is, why not start coding?
Answer - 26 : - CSS is sort of like scripting language made for the web. In contrary with HTML, DHTML, JavaScript, VBScript and many others. CSS is strictly for formatting your web-page and now many new browser support it. (NOTE: Older browser do not support CSS, so please check your browser version and make sure whether it supports it or not. You may have to update your current Browser.)
The way the code goes into your Web-page is through a variety of ways. The way CSS works is that is the code is set between the
tags. You can put the CSS code after which is what most people do. Now, here are the following ways of making your webpage with CSS enabled features:
1.) Writing your CSS code within your HTML source code. This is how it would look like:
My First CSS!
2.) Linking to your CSS file. This tells the webpage to find the .css file and use it as the CSS code. Here is the code that would allow you to do:
CSS
tag is pretty helpful. What it does is that it links to the style.css file which has all the css code. Just like embedding an image throught he
tag.
Now to explain a bit from the first example. CSS code isn't very hard to understand.Take for example the body { ..} part. What it does is that it formats how the tag in HTML would work. That is a very