Skip to content

Commit 14951c0

Browse files
Jason Rogersmarijnh
authored andcommitted
Add 'table-layout: fixed' to book's CSS in Ch. 15
This commit adds a line -- 'table-layout:fixed' -- to the '.background' CSS displayed in the book's Chapter 15 ('Project: A Platform Game'). This line is required in order for the game to function properly in Google Chrome (at least versions 38 and 39). If the line is not included, Google Chrome's table layout algorithm can alter the size of the table cells constituting the game's background, resulting in buggy behavior (e.g., the player will 'hit' walls before the player icon is actually touching a displayed wall). The relevant line is already included in the downloadable code for the book. This commit simply adds it, together with a brief explanation, to the CSS displayed in the book text, so that readers who are typing along with the book will end up with a working game.
1 parent 1eb3c8f commit 14951c0

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

15_game.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -489,16 +489,18 @@ want:
489489
[source,text/css]
490490
----
491491
.background { background: rgb(52, 166, 251);
492+
table-layout: fixed;
492493
border-spacing: 0; }
493494
.background td { padding: 0; }
494495
.lava { background: rgb(255, 100, 100); }
495496
.wall { background: white; }
496497
----
497498

498-
(((padding (CSS))))Some of these (`border-spacing`
499+
(((padding (CSS))))Some of these (`table-layout`, `border-spacing`,
499500
and `padding`) are simply used to suppress unwanted default behavior.
500-
We don't want space between the ((table)) cells or padding inside
501-
them.
501+
We don't want the layout of the ((table)) to depend upon the contents
502+
of its cells, and we don't want space between the ((table)) cells or
503+
padding inside them.
502504

503505
(((background (CSS))))(((rgb (CSS))))(((CSS)))The `background` rule
504506
sets the background color. CSS allows colors to be specified both as

0 commit comments

Comments
 (0)