HTML CSS Interview Questions & Answers part 2

0
298

Q: – How do you show which page you're on (in a menu)?

If PHP is not available to you, you could use the cascade. Put an id in your body tags and an id in each of your 'a' tags for the links.
Let's say on page one you have this:
CSS
<body id="page1">
….
<a id="page1link" href="page1.htm">page one</a>

</body>
In your CSS, you can have something like this:
CSS
#page1 a#page1link {
color:purple;

Q: – How can I place multiple blocks next to each other?

In theory, the following will produce 4 "columns":
<DIV style="float: left; width: 25%;">Block 1</DIV>
<DIV style="float: left; width: 25%;">Block 2</DIV>
<DIV style="float: left; width: 25%;">Block 3</DIV>
<DIV style="float: left; width: 25%;">Block 4</DIV>

Each "column" will occupy 25% of the screen. This relies on a correct implementation of float, which cannot be said of many legacy browsers. If you cannot accept display variances in older browsers, then it may be best to fall back to table-based solutions.
2. By making the block an inline element and then use text-align property
<DIV STYLE="text-align: center">
<TABLE STYLE="display: inline">

</TABLE>
</DIV>

This technique depends on the incorrect implementation of text-align behavior in older browsers. It will likely cease to work in future CSS-conformant browsers, and eventually it will probably not be a viable solution.

Q: – Document Style Semantics and Specification Language (DSSSL)?

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.

Q: – What is Extensible Stylesheet Language (XSL)?

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.

Q: – Why does Netscape lose my styles ?

Netscape 4.x has poor support for CSS. Having said that, the following points should be noted.
Invalid HTML will almost certainly cause Netscape to ignore your CSS suggestions at some point. You will find that valid HTML is your best friend, but for Netscape to work properly you must ensure that all elements in your markup which permit closing tags are explicitly closed.
Check and correct your CSS suggestions for the very same reason, Netscape 4.x is in fact doing "the right thing", as per CSS specs (as opposed to MSIE) when it ignores style rules with errors.
Netscape 4.x has what's called an "inheritance problem" into its TABLE element. It can be argued that NS is all within its right to behave as it does in this case, but since the workaround is quite simple it's easy enough to just use it and be done with it.
Let's say you want your TABLE content to "look the same" as your BODY content? "Redundant" styling comes to your help as in e.g. BODY, TABLE, TH, TD { /* insert your styles here */ }
On a generic level, Netscape 4.x likes to have style rules applied directly to the elements where they are needed. You can never really trust the inheritance principle to work correctly at any level in Netscape 4.x.

Q: – Why is it my ':hover' declaration for links does not work ?

Assuming you have already checked that your style sheet declarations do conform to correct CSS syntax, it could be that you have overlooked the importance of a correct order of style declarations for links.
The CSS2 specification makes this following note on the importance of placing the dynamic pseudo-classes ':hover' and ':active' in correct positions in a list of style declarations.
Note that the 'a:hover' must be placed after the 'a:link' and 'a:visited' rules, since otherwise the cascading rules will hide the 'color' property of the 'a:hover' rule.

Similarly, because 'a:active' is placed after 'a:hover', the active color will apply when the user both activates and hovers over the 'a' element.

Submitted By:-Payal Gupta            Email-ID: – payalgupta1325@yahool.com
SHARE

LEAVE A REPLY