Without Book Interview Questions and Answers | Online Test | Moct Test
Download Android App in your Android Device from Google Play Store
- Search for "Withoutbook Practice Exam Test" in Mobile/Tablet Play Store
Institute Training Search by Name or Email

Exams Attended

Make Homepage

Bookmark this page

Subscribe Email Address

CSS Interview Questions and Answers

Ques 56. CSS is clearly very useful for separating style from content. But apparently people tend to have problems when using it for layouts. Would you say this is because people have not yet understood how to properly do layout in CSS, or is it CSS that is lacking in this area? What can be done to improve the situation? --- Would the web benefit from HTML and CSS being complemented with some kind of \"layout language\"?

Ans. Layout and style should be tackled by the same language and the two are intertwined. Trying to split the two is like splitting the HTML specification in two, one specification describing inline elements and the other describing block elements. It\'s not worth the effort. CSS is capable of describing beautiful and scalable layouts. The CSS Zen Garden has been a eye-opening showcase of what is possible today. If MS IE had supported CSS tables, another set of layouts would have been possible. So, there is still lots of potential in the existing CSS specifications which should be the next milestone.

Is it helpful? Add Comment View Comments
Ques 57. I always wanted to have "included" substyles or "aliases" in my CSS definition, to save redundancy.
(For includes)

.class1 { color:#ff0000; }
.class2 { background-color:#ffffff; }
.class3 { include:class1,class2;font-weight:bold; }

(For aliases)

@alias color1 #ff0000;
@alias color2 #ffffff;
@alias default_image url('/img/image1.jpg');

.class1 { color:color1; }
.class2 { background-image:default_image;background-color:co lor2; }

This way we could change colors or images for a whole webpage
by editing a reduced number of lines.
Had you considered any of these ideas in the past? If so, why were they rejected?
Ans. Yes, aliases and constants have been considered. CSS is already an indirection. Instead of putting properties and values directly on elements, it associates properties and values with selectors. What you (and others) are proposing is to add another layer of indirection. By doing so, one could possible write shorter, more manageable style sheets. However, there are also some downsides. It requires a new syntactic construct (@alias) and implementations must be able to remember a list of aliases.
Is it helpful? Add Comment View Comments
Ques 58. Styles not showing?
Ans. There are different ways to apply CSS to a HTML document with a stylesheet, and these different ways can be combined:

* inline (internal) (Deprecated for XHTML)
* embedded (internal)
* linked (external) and
* @import (external)

Note: An external stylesheet is a text file that contains only CSS Styles. HTML comments are not supposed to be in there and can lead to misinterpretation (> is the CSS \"Child\" selector!).
Is it helpful? Add Comment View Comments
Ques 59. How do I quote font names in quoted values of the style attribute?
Ans. 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.
Is it helpful? Add Comment View Comments
Ques 60. Why is my external stylesheet not working ?
Ans. There may be several different reasons behind that, but one very common mistake is to have an external stylesheet that contains HTML markup in some form.

An external stylesheet must contain only CSS rules, and if required, correctly formed CSS comments; never include any HTML syntax, such as <style type=\"text/css\">?
CSS comments are defined as anything that is placed between
/* (the comment start mark) and
*/ (the comment end mark). I.e. as follows?

/* This text right here is a correct CSS comment */

CSS comments may span multiple lines in the stylesheet. Nesting of CSS comments is not allowed.

Another reason for external stylesheets (and even embedded and inline stylerules) not to function as expected may be that you have tried to make use of some CSS-features that are not supported in the browser you are using.

External stylesheets shall also be served from the www-server with a MIME-type of \'text/css\' in its \'Content Type:\' HTTP header.
You may need to negotiate with your server admin to add this MIME type to your server if you are not able to configure the server yourself.
Is it helpful? Add Comment View Comments

(For includes)

.class1 { color:#ff0000; }
.class2 { background-color:#ffffff; }
.class3 { include:class1,class2;font-weight:bold; }

(For aliases)

@alias color1 #ff0000;
@alias color2 #ffffff;
@alias default_image url('/img/image1.jpg');

.class1 { color:color1; }
.class2 { background-image:default_image;background-color:co lor2; }

This way we could change colors or images for a whole webpage
by editing a reduced number of lines.
Had you considered any of these ideas in the past? If so, why were they rejected?
3) Styles not showing? 4) How do I quote font names in quoted values of the style attribute? 5) Why is my external stylesheet not working ? " />

Most helpful rated by users:

©2016 WithoutBook