I’m currently working on a Udacity Front-End Web Developer course, thanks to a Grow with Google Challenge Scholarship. It’s a course that goes over HTML, CSS, JavaScript, JQuery, and a few other things.
For me, it’s a bit of a review – I used to maintain a personal website for fun when I was a teenager, back before Myspace and Facebook were a thing. 😉
One assignment to practice HTML and CSS is to modify a basic animal trading card:
After practicing with the example, I decided to take it a step further and try to make Pokemon cards using only HTML, CSS, and a few images.
The Code
The finished HTML for the structure of the cards and CSS for the style of the cards are both available on my GitHub.
Let’s see how it went.
CSS Breakdown
First, I broke down the overall page setup as well as a typical Pokemon card into components and thought about how the structure (HTML) and style (CSS) would work.
Overall div that represents the card – Defined with a class to have a gradient background, gold border, fixed height and width
Top table – 2 rows. Top row column span 3, bottom row 3 columns. 100% width.
Basic Pokemon – TD class sets bold text, font size 11.
Name of Pokemon – TD class sets bold text, font size 18.
HP – TD class sets bold red text, font size 20, text aligned to the right.
IMG – The type of the card contains a small image. A TD class aligns this to the center and fixes the width of this cell at 5%.
Image of Pokemon – 300px wide by 200px tall
Pokemon Vitals – P class sets 2px of padding from above image (so that drop shadow does not interfere). The background is a linear gradient from goldenrod to yellow to goldenrod. Font size is 11px, italic, bold, and aligned to center.
Attacks – Each attack has its own table. They are separated by simple horizontal rules.
IMG – The energy cost is an image. A TD class sets the width to 18%, and the image aligns to the center.
Attack 1 – A span class sets the font to bold size 16.
Description – A span class sets the font size to 11.
DMG – The damage uses a TD class. The text is bold and aligned to the right.
Weakness, Resistance, Retreat Cost – This is all contained in one table with 3 columns and 2 rows. The table has a class to set the text to size 11 and centered, and the table width to 100%.
Header row has a TR class to set the headers to bold text. This could also have been achieved by making the table’s class have bold text since the next row only has images.
Cost icons are images.
Description – A P class sets the text to centered bold italic at size 11. The entire paragraph is bordered by 3 px solid gold, with a rounded radius of 6px.
Illustrator, Copyright, Series – This is a P class that sets the font size to 11 and the text aligned to center. The HTML sets the Illustrator and Series to bold text.
Then I put the code together, testing and modifying it until the cards looked like the originals!
Results
Once the HTML and CSS were written, it was just a matter of filling in the card information and images.
Here are the cards in the browser:
And here are photos of the real cards (left) versus the CSS cards (right).
I intentionally changed a few things around (names of attacks, HP, etc.) to show that I really wrote the HTML and CSS for them and didn’t just use an image editing program to modify the card photos. 🙂
Takeaways
Once I had the HTML and the CSS written, it was very easy to make subsequent cards. I created a dual class for the background div that set the background gradient color as well as the gold border of the card. For different types of Pokemon, I created a different class for each gradient combination, and the HTML references the CSS class for the proper gradient, which saves a lot of coding time.
The card “guts” can just be copy and pasted into infinity. They reference the same CSS classes for every card (except for the background, as I just mentioned). If you’ve already made a bunch of cards and decide you want to change something about the style – no worries, just modify the CSS, and every card gets the new style with one edit.
The only things you need to update to make a new card are the images and text.
This project was extremely helpful in understanding the power of HTML and CSS working together. 🙂
CSS – Fake Pokemon Cards I'm currently working on a Udacity Front-End Web Developer course, thanks to a Grow with Google Challenge Scholarship…


















