Book Image

Canvas Cookbook

Book Image

Canvas Cookbook

Overview of this book

With the growing popularity of HTML5 Canvas, this book offers tailored recipes to help you develop portable applications, presentations, and games. The recipes are simple yet creative and build on each other. At every step, the book inspires the reader to develop his/her own recipe. From basic to advanced, every aspect of Canvas API has been covered to guide readers to develop their own application, presentation, or game.
Table of Contents (16 chapters)
Canvas Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Styling text and background using CSS


As mentioned earlier, CSS can be used for styling and here is a simple demo of styling text. The output of the recipe is given here:

How to do it

The recipe is as follows:

The HTML code:

<html>
<head>
  <title>CSS Background Example</title>
  <link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body class="main">
  <center>
  <table border=1>
    <tr class="firstrow">
      <td height="200" width="800"> 
        <h1 id="title">CSS Demo</h1>
      </td>
    </tr>
    <tr class="secondrow">
      <td height="400" width="800" align="center">
        <p>This is a simple demo of CSS exhibiting usage of a tag-specific style and selectors.<br>
          The file background.css contains all the styling properties which are applied here on the HTML Page.
        </p> 
      </td>
    </tr>
  </table>
  </center...