Creating Android App 4

5:33:00 PM |

Even if you aren’t running Mac OS X, you should use Chrome when
testing your Android web apps on a desktop web browser, because
Chrome is the closest desktop browser to Android’s mobile browser.
Chrome is available for Mac and Windows from http://google.com/.
chrome
Introduction to CSS
As you’ve seen, browsers render certain HTML elements with distinct styles (for example,
headings are large and bold, paragraphs are followed by a blank line, and so
forth). These styles are very basic and are primarily intended to help the reader understand
the structure and meaning of the document.
To go beyond this simple structure-based rendering, you use Cascading Style Sheets
(CSS). CSS is a stylesheet language that you use to define the visual presentation of an
HTML document. You can use CSS to define simple things like the text color, size, and
style (bold, italic, etc.), or complex things like page layout, gradients, opacity, and much
more.Example 1-4 shows a CSS rule that instructs the browser to display any text in the body
element using the color red. In this example, body is the selector (this specifies what is
affected by the rule) and the curly braces enclose the declaration (the rule itself). The
declaration includes a set of properties and their values. In this example, color is the
property, and red is the value of the color property.
Example 1-4. A simple CSS rule
body { color: red; }
Property names are predefined in the CSS specification, which means that you can’t
just make them up. Each property expects an appropriate value, and there can be lots
of appropriate values and value formats for a given property.
For example, you can specify colors with predefined keywords like red, or by using
HTML color code notation, which uses a hexadecimal notation: a hash/pound sign
(#) followed by three pairs of hexadecimal digits (0–F) representing (from left to right)
red, green, and blue values (red is represented as #FF0000). Properties that expect measurements
can accept values like 10px, 75%, and 1em.Example 1-5 shows some common
declarations. The color code shown for background-color corresponds to the CSS
“gray.”
Example 1-5. Some common CSS declarations
body {
color: red;
background-color: #808080;
font-size: 12px;
font-style: italic;
font-weight: bold;

0 comments: