I attended THATCamp Prime (aka THATCamp CHNM) this past weekend. If you don’t know what a THATCamp is, go check it out: it’s a digital humanities “unconference”, a format which really hones in on the best parts of conferences: getting to talk with people passionate about similar work without the boredom of bad PowerPoint design and read-aloud papers, less stifling of voices by differences in rank, and more hack (making) in addition to yack (just talking).
The unconference kicked off on Friday with a series of “Bootcamps”, which were workshops that taught practical DH skills; I was lucky to receive one of the THATCamp Bootcamp Mellon Fellowships to attend. Jeremy Boggs (@clioweb, clioweb.org) started the “advanced hack” track with sessions on HTML5/CSS3 and jQuery. If you’re like me, you spend a decent amount of time checking out other sites’ source code to see how designers are structuring their view these days. If you’re also like me and haven’t completely ingested the newest standards yet, you’re in luck; Jeremy provided a succinct overview of the changes in these new standards, and I took notes!
In this post, I’ll be covering what I learned in the session on HTML5 and CSS3. I also attended Jeremy’s Hack Track session on jQuery, though I didn’t take enough notes to write up here; our main work in the session was to customize someone else’s jQuery code and use it within our web page, something I was already familiar with. You can check out my example web page using the link at the bottom of this post, though, if you’d like to look at the jQuery we wrote.
Jeremy did a great job of pacing the material and leading us through small tweaks and experiments with the code. I think the best testament to his teaching is passing it on here to anyone else reading this with web design interests, so here you go!
HTML5: Paving the Cowpaths
HTML5 is largely a standardization of what designers already do.
Doctype. The doctype for HTML5 is simple:
- All you need is <!DOCTYPE html> instead of the old several lines of code
- The old charset line in the header is replaced by a simple line such as <meta charset=”utf-8″>
- Other unnecessary doctype redundancies such as text/css in the style tag drops out (designers almost always use it, so it’s assumed)
Fun dork fact! The first HTML document Tim Berners-Lee wrote can have an HTML5 spec added to it and it will work; everything from 10, 20 years ago validates with HTML5!
Divs and Tags. HTML5 adds new tags and attributes that shorten the work that everyone does every time they write an HTML page while making those pages more accessible:
- Some of the most common <div> uses are replaced with their own tags (e.g. <div id=”header”> can now be written as <header>); this holds for <footer>, <nav>, <aside>, <article>, and more
- New attributes such as “role”, which calls from a predefined list of assistive technologies (google “W3C wai-aria” for more)
- The role of “banner”, for example, can be used to hold information that’s oriented toward your entire site rather than page-specific; the role for navigation is another possibility. While to some extent these tags appear to be just another level of nicely-structuring semantics, they’re important for people using screen-readers or mobile devices who might want to find–or skip over–such page elements.
- The form tag lets you specify “input types” such as “email”; this appears just like plain text input, but you can access it with scripts to add functionalities–and it even automatically changes to the keyboard if you’re using a smartphone! Other input types include “tel” (telephone) and “search” (as with all these notes, google the HTML5 specs for more possibilities).
- Form inputs further let you specify attributes such as “placeholder” (example search entry that goes away when you click to type in your text, for example)
Grammar. HTML5 does something both horrifying and wonderful: it drops the “grammar” of good HTML, that set of best practices for producing a nicely structured, readable, and up-til-now validating HTML page: head and body tags aren’t necessary, tags can contain upper- and lower-case letters, etc. –all kinds of non-XHTML gunk. It all validates in HTML5. My initial horror (oh no, new web designer are going to create a new legacy of hard-to-read HTML!) was replaced by understanding; this decision lets older pages validate under the new standard, and the grammar and good structural practice can still be used for code clarity.
CSS3: Goodbye Tiny Image Files!
For our work with CSS3, we included our code in the HTML header for time’s sake (but please don’t do this on any real site!). Here are a couple neat tricks we covered.
Rounded Corners. No longer do you need to upload a rounded-corner image! Simply declare something like
border-radius: 20px;
and you’re set. In the example, this is like creating a circle that has a radius of 20px and displaying a quarter arc of that circle as the corner.
An important note: there are browsers that still don’t support these techniques. First, make sure your site is structured so that the content readable whether your user has the latest Firefox or IE6 (well, maybe IE7…) with javascript turned off. Also try using namespace-prefixed properties in addition to the standard CSS# property; these allow particular browsers to access these values if possible:
-moz-border-radius: 20px; (for Firefox)
-webkit-border-radius: 20px; (for Safari and Chrome)
-o-border-radius: 20px; (for Opera)
Don’t forget to give the background behind your round-cornered box a different color so the rounded corners show up against it!
The Box-Shadow. Jeremy termed this technique “a renaissance of drop shadows”, and indeed we did end up with pages looking a little too dated–but there is a time and a place for the box-shadow, and CSS3 lets you deploy it without creating an image file of a shadowed rectangle. You’ll need to specify four attributes:
- how far from top of the document the shadow starts
- how far from left it starts
- the width of the shadow
- the color of the shadow
For #4, you can use the old hex colors or a new technique: CSS3 adds a new way of adding colors called RGBA (red green blue alpha). Simply provide the R G and B amounts, then use the alpha attribute to declare the degree of transparency you desire. For example,
box-shadow: 10px 10px 20px rgba(0,0,0,0.5);
results in zero red, green, or blue, and half transparency. As with rounded corners, you can use -webkit, etc. here again to get this working with more browsers.
But what if I want to make a tilted sticky note with Comic Sans font. I thought you’d never ask. CSS3′s transform property lets you tell a div to rotate a certain number of degrees, like so:
transform: rotate(10deg);
Some CSS to achieve a yellow sticky note might look like the following:
#sticky {
background-color: yellow;
float: right;
width: 200px;
font-family: “Comic Sans MS”, serif;
margin-left: 20px;
margin-right: -100px;
margin-bottom: 20px;
padding: 20px;
box-shadow: 0 0 5px rgba(0,0,0,0.25);
-moz-box-shadow: 0 0 5px rgba(0,0,0,0.25);
-webkit-box-shadow: 0 0 5px rgba(0,0,0,0.25);
-o-box-shadow: box-shadow: 0 0 5px rgba(0,0,0,0.25);
transform: rotate(10deg);
}
Jeremy mentioned CSS3Please.com as a good site to check out for more CSS3 learning; the site lists every CSS3 property with vendor-specific information.
Read More
Jeremy recommended the following books for further reading:
HTML5 for Web Designers by Jeremy Keith
CSS3 for Web Designers by Dan Cederholm
HTML5: Up and Running by Mark Pilgrim
Handcrafted CSS: More Bulletproof Web Design by Dan Cederholm
Want to play around with the code?
I posted the HTML5/CSS3/jQuery page I made in the workshops here, and I recommend viewing the source and even pasting it into a text editor and playing around with it a bit. To get the jQuery working, you’ll need to go here and place the jquery.cycle.all.min.js file at the same level as your html file.
Caveat: The page is NOT meant to be pretty. Some of the neat things you can do easily with the new standards, when taken together, look a lot like a Geocities overload page! Clumping them together on a single simple page, however, lets you easily play and learn them. The page also uses CSS in the header, which is generally bad practice because it takes up a lot of space and doesn’t apply across pages. Again, for a practice page it just makes things easier.
Final Comments
If you’re a digital humanist (academic or alt-ac), humanist with digital interests, or geek with a passion for history, literature, or other humanities fields, I highly recommend attending a THATCamp (I loved it so much I’m now co-organizing one!). Whether you’re a well-known name or someone who knows “nothing” but is eager to learn, these unconferences are a great space for people to share their love of the geek-nerd ,etling pot that is DH! Check out the THATCamp page for more information or go here to see and apply to upcoming camps.
HTML5 and CSS3 have been something I’ve been meaning to learn more thoroughly for a while–not just from seeing the neat address-bar games and browser-based Conway Games of Life, but also from noticing new techniques popping up in other people’s code. The fastest way to learn this kind of skill (for me, at least) has always been to learn a few new tricks at a time, use them right away to be certain I understand how to get them working, and think about how I might use them in my own projects. Besides now being able to adopt the latest standards into my DH web design, I’m now able to read other people’s code better. Most importantly for me, I found an important practical application of Jeremy’s jQuery lesson: I now better understand how to hack a jQuery image presenter I’m using on the front of Digital Dos Passos to get it to work with Omeka exactly how I want, and I’m more comfortable with using jQuery in my next digital projects.
Daily Digest for June 7th « Jason Kucsma
on Jun 7th, 2011
@ 10:47 am:
[...] Shared Happiness is a room full of humanities coders – Literature Geek. [...]
links for 2011-06-07 | Kuple
on Jun 7th, 2011
@ 9:05 pm:
[...] Happiness is a room full of humanities coders – Literature Geek (tags: coding html5 tutorial) [...]
THATCamp 2011 Roundup - ProfHacker - The Chronicle of Higher Education
on Jun 8th, 2011
@ 2:03 pm:
[...] “Happiness is a room full of humanities coders,” by Amanda Visconti In this post, I’ll be covering what I learned in the session on HTML5 and CSS3. [...]
Ian T. Thomas » Blog Archive » My THATCamp Prime 2011
on Jun 13th, 2011
@ 5:00 pm:
[...] my journey to better understand coding and web design. Check out Amanda Visconti’s excellent write-up of the session for more [...]
Notes from HTML5 hack session | THATCamp Philly
on Sep 24th, 2011
@ 9:53 am:
[...] “Happiness is a Room Full of Humanities Coders” — report on Jeremy Boggs’s H… [...]