HTML5 Canvas and CSS3 Animations

This is my last blog posting for this course, CR2170. I would like to write about animation using HTML5 canvas and CSS3 Keyframes.

What is HTML Canvas?

The HTML <canvas> element is used to draw graphics, on the fly, via scripting (usually JavaScript). The <canvas> element is only a container for graphics. You must use a script to actually draw the graphics. Canvas has several methods for drawing paths, boxes, circles, text, and adding images.

Canvas can draw colorful text, with or without animation, and it has great features for graphical data presentation with an imagery of graphs and charts. Canvas objects can move everything from simple bouncing balls to complex animations. Canvas can respond to JavaScript events and to any user action (key clicks, mouse clicks, button clicks, finger movement). Canvas’ methods for animations, offer a lot of possibilities for HTML gaming applications. (

What are CSS3 Animations?

An animation lets an element gradually change from one style to another. You can change as many CSS properties you want, as many times you want. To use CSS3 animation, you must first specify some keyframes for the animation. Keyframes hold what styles the element will have at certain times. (

My Examples

I created two animated banners for my Coffee Lounge website: the one uses HTML5 canvas animation (The Newfoundland Gardener), and the other uses CSS3 animation (Origami Competition). The Origami Competition banner is quite simple: the background and the text colors are changed by CSS Keyframes properties over a period of time. If I created the same banner with Flash animation, it would have taken much longer to set the time and the color changes the way I did in CSS animation.

Origami Gardener

Figures 1 and 2: The Origami Competition Banner and The Newfoundland Gardener Banner

Source: Naomi Kobayashi (2015)

The Newfoundland Gardener banner is more complex than the CSS animated banner. This banner has three layers (<div>s), and each layer is controlled by JavaScript functions. The letters, “The Newfoundland Gardener” and  “Subscribe Today!” move slowly from one side to the other. This banner would have been easier to create with Flash animation, since it I would not need to write a code, and stacking the <div>s in the right spot was not so easy, especially for my responsive design site.


HTML5 canvas and CSS Keyframes are quite different. HTML canvas is better used for more complex tasks, such as interactive animation or games, while CSS animation is more suited for providing simpler animated effects for websites. I believe HTML5 and CSS3 are good alternative for Flash animation, since they don’t require any plug-ins and work with any modern browsers. I don’t think Flash would be dead any time soon, but I believe HTML5 and CSS3 would replace some light-weight animations such as banners, since Flash animation does not work well with mobile devices. I’m not certain what would happen if we combine HTML5 canvas and CSS Keyframes together, but I would imagine creating animation would be easier and more fun using these two technologies together.

Thank you very much for reading my blog posts, and I hope you enjoy reading them. 🙂

Grid Based Layout


As I mentioned the last post, grid and card based layouts have been web design trend for the last few years. Pinterest, Google Now and Digg are the examples. Grid layout is great for responsive websites for the following reasons.

1) It scales to any widths.

2) It does not have fixed numbers of columns.

3) It is defined easily with HTML5 and CSS3.

4) It makes easier to organize the content.

5) Users can find information faster.

(Miller, n.d.)

Grids Are Flexible

Grids are defined by percent but not numbers of pixels, so grid based page can accommodate any screen size, from desktop computers to cell phones. Unlike tables, the numbers of columns are not static: they can be increased or decreased based on screen size. We can arrange multiple screen layouts for different screen sizes in one web application by using Cascading Style Sheet. If a grid seems too narrow for one screen width, we can reduce the numbers of grids for the particular screen resolution without compromising other screen sizes.
(Miller, n.d.)

Grids Look Neat and Organized

I created a website for a fictional coffee bar, Coffee Lounge last spring. This site was developed for PR1100 – Website Project I and is not fully functional. I decided to use this website again for the first project of this course, CR2170 – Trends in Web Development to make the site fully working, including code-behind in ASP.NET and C#. One of the issues I found the last semester was that the text links were too small for mobile users to click, although the site was meant to be fluid enough to fit all devices. I think this is a good time to re-design the website in order to improve the user experience, especially for small screens.

I wanted to apply some of the web design trends to my websites, so I choose to use grid layout for the new version of the Coffee Lounge website. I had implemented the site in HTML5 for the structure and CSS3 for styling already, so it was painless to apply grids. It turns out to be faster and easier to find the information, it fits and looks better, especially with mobile devices and it looks more attractive. Figure 1 is the current design, and figure 2 is the new version of the site, which is under construction, and hopefully it will be uploaded in mid-February.


Figure 1: Current Coffee Lounge Home page

Source: Naomi Kobayashi (2014)


Figure 2: New Coffee Lounge Home page

Source: Naomi Kobayashi (2015)

With the current site, the user has to read from the top to find the information he or she is looking for. The user can find the information faster and can point at icons or text links easier with the new design because the targets become bigger. I also find re-arranging the information easier since everything is in individual containers, <div>.


Grid layout is gaining popularity due to its flexible structure and its well-formed format. The structure also makes easier to arrange and to search the information. The new layout will improve the user experience of my website as well.


Figure 3: Current Site Map for Mobile Devices

Source: Naomi Kobayashi (2014)


Figure 4: New Site Map for Mobile Devices

Source: Naomi Kobayashi (2015)


Miller, G. (n.d.). Responsive Grid System. Retrieved from Spectacularly Easy Responsive Design:

Moveable Online. (2014, February 14). Web design trends that will be popular in 2014. Retrieved from