Interview questions in css and css3

1) What is css ?

Sol : Css stands for cascading style sheets.  It is is styling language marked the beginning of style sheets in 1980s.

2)What are the different versions of css launched upto now?

Sol: The different are as follows :

a)css 1

b)css 2

c)css 2.1

d)css 3

e)css 4 

3)Who maintains the css specifications ?

Sol : w3c World webconsortium maintains the css specifications.

4)How many ways the css can be used in html page ?

Sol : The css can be included in following ways :

a)Inline css : Style attributes are used with html tag

b)Embedded css : The head element for the html contains all the styles

c)Linked/ Imported : These are the external files . We need to reference them in our web page , to get their styles

5)What is css box model ? What are it’s attributes ?

Sol : Box model defines the design and layout of elements of css. The various elements are :

Margin: the top most layer, the overall structure is shown
Border: the padding and content option with a border around it is shown.  Background color affects the border.
Padding: Space is shown. Background colour affects the border.
Content: Actual content is shown.

6)Selector grouping and Contextual Selector on CSS

a. Selector grouping example 
   td, th, li { property: value; }

b. what the above is saying that you want to have the same value for the same property for all td,th, and lib. Contextual Selector example table p { property: value; }

this one is saying that you want to set the value for <p> tags that belongs to <table> tags

so whenever you have a <p> in a <table>, then it will get effected.

7)Image sprites in css ?

Sol :

An image sprite is a collection of images put into a single image.A web page with many images can take a long time to load and generates multiple server requests.Using image sprites will reduce the number of server requests and save bandwidth.

Example :

<!DOCTYPE html>
#navlist {
position: relative;

#navlist li {
margin: 0;
padding: 0;
list-style: none;
position: absolute;
top: 0;

#navlist li, #navlist a {
height: 44px;
display: block;

#home {
left: 0px;
width: 46px;
background: url(‘img_navsprites.gif’) 0 0;

#prev {
left: 63px;
width: 43px;
background: url(‘img_navsprites.gif’) -47px 0;

#next {
left: 129px;
width: 43px;
background: url(‘img_navsprites.gif’) -91px 0;

<ul id=”navlist”>
<li id=”home”><a href=”default.asp”></a></li>
<li id=”prev”><a href=”css_intro.asp”></a></li>
<li id=”next”><a href=”css_syntax.asp”></a></li>


By Pankaj Kumar Agarwal

Leave a reply:

Site Footer