HTML and CSS Reference
In-Depth Information
Bitmaps are often used to paint the background of the entire page. If the page is rich in content
and scrolls horizontally or vertically, what should the image do? Should it scroll with the rest of the
page or should it stick to its original position and have the content scroll over it? You can control that;
here's how:
body {
color: #ffffff; /* white */
background-image: url(/images/bkgnd.png);
background-repeat: no-repeat;
background-attachment: fixed;
}
The background-attachment property accepts either of the following two values, whose meanings
are straightforward: fixed and scroll .
Controlling text
In any HTML document, the text is the most important part. Hence, choosing the right combina-
tion of font and effects is key for a successful page. All browsers use a default font for the text and
this font (that is, Times New Roman) is often not appropriate for most users. Switching to a different
font family couldn't be easier. However, before you learn that, a consideration specific to Windows 8
programming is in order.
Important Windows 8 comes with its own highly specific user interface. The primary
font is Segoe UI. Since you may write Windows 8 applications using HTML and CSS, you
are allowed to change the font. However, this is not a recommended practice. In some
cases, changing font family and size may even give you a hard time uploading the final
application to the Windows Store. In general, when it comes to using CSS for Windows 8
applications, changing the font family and font size becomes a delicate point. You should
not do this, unless it is necessary and even then possibly only for small portions of the user
interface. Instead, you should use the default Windows JavaScript style sheets, as you'll
encounter in Chapter 5, “First steps with Windows 8 development.”
Choosing the font family and size
In CSS, you use the font-family property to indicate one or more families of fonts you would like
to use. When it comes to fonts and browsers, it should be clear that the content of the font-family
property is only a recommendation for the browser. Since the webpage is hosted on a website and
viewed on a local computer, it may be that the local computer is not equipped with the requested
font. For this reason, it is a good practice to always indicate alternate fonts, as shown below:
body {
color: #ffffff; /* white */
Search WWH ::




Custom Search