QA


Q&A

Q.

Why can't I just place style rules directly in XML code?

A.

XML code must adhere to XML syntax, which consists of elements and attributes. CSS is not an XML-based markup language, which immediately excludes its usage within XML documents using familiar XML elements and attributes. Technically, it could be possible to use inline CSS styles with XML content by way of a special attribute, such as style, which is supported in HTML. However, even this special attribute would need to be supported by the particular XML-based markup language being used in the document. Because there is no such standard XML language, the style attribute isn't recognized in XML documents for viewing in web browsers. In other words, you must use external style sheets if you plan on using CSS alone to style your XML documents.

Q.

How do you know when to use relative versus absolute positioning?

A.

Although there are no set guidelines regarding the usage of relative versus absolute positioning, the general idea is that absolute positioning is required only when you want to exert a fine degree of control over how content is positioned. This has to do with the fact that absolute positioning allows you to position content down to the exact pixel, whereas relative positioning is less exacting in terms of how it positions content. This isn't to say that relative positioning can't do a good job of positioning XML content; it just means that absolute positioning is more explicit.

Q.

If you don't specify the z-index of two elements that overlap each other, how do you know which element will appear on top?

A.

If the z-index property isn't set for overlapping elements, the element appearing later in the XML content will appear on top. The easy way to remember this is to think of a web browser drawing each element on a page as it reads it from the XML document; elements read later in the document are drawn on top of those read earlier.

Q.

Is there a way to know if a font is installed on a system when specifying it in a style sheet?

A.

No. Different users may have different fonts installed, and there is no way to predict which fonts will be available. The best solution to this problem is to use popular fonts or system fonts and always provide a secondary font that is ideally a system font.




Sams Teach Yourself XML in 24 Hours
Sams Teach Yourself XML in 24 Hours, Complete Starter Kit (3rd Edition)
ISBN: 067232797X
EAN: 2147483647
Year: 2005
Pages: 266

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net