Game Development Reference
In-Depth Information
Figure 1-2. A very simple HTML page
Once you've created an HTML document, you can apply a style to it. For example, you might want
to change the layout of the various parts of an HTML document, or you might want to use a different
font or apply a background color. The style can be defined as a part of the HTML document, or you
can define a style using a CSS (Cascading Style Sheet) file.
Although we do not cover style sheets (CSS files) in this topic in detail, I make limited use of them for
correctly positioning game content in the browser window. For example, this simple style sheet sets
the margins of an html page and its body to 0:
html, body {
margin: 0;
}
If you want your HTML page to use a CSS file (style sheet), you simply add the following line to the
<head> part:
<link rel="stylesheet" type="text/css" href="game-layout.css"/>
I will use the preceding style sheet in most of the game examples in this topic. In Chapter 13, I will
expand the style sheet to allow for automatic scaling and positioning of the content to different
devices.
 
Search WWH ::




Custom Search