Below are the code examples used in my Spring Break talk. The slides PDF can be downloaded here.
The entire video of the presentation (including slide screens) can be found here.
| ID | First Name | Last Name | Weapon |
|---|---|---|---|
| 1 | Indiana | Jones | Whip |
| 2 | Marion | Ravenwood | Frying Pan |
| 3 | Mutt | Williams | Switchblade |
td.alt { background:#eff1f3; }<td class="alt">...</td><td class="alt">...</td>
table tr:nth-child(even) td {
background:#eff1f3;
}
$('table tr:nth-child(even) td').addClass('alt');
| ID | First Name | Last Name | Weapon |
|---|---|---|---|
| 1 | Indiana | Jones | Whip |
| 2 | Marion | Ravenwood | Frying Pan |
| 3 | Mutt | Williams | Switchblade |
td.last { border:none; }<td>...</td><td>...</td><td class="last">...</td>
table#border tr th:last-child, table#border tr td:last-child {
border:none;
}
$('table#border tr th:last-child, table#border tr td:last-child')
.css('border','none');
li.last { border:none; }<li><a href="">...</a></li> <li><a href="">...</a></li> <li class="last"><a href="">...</a></li>
ul#nav li:last {
border:none;
}
$('ul#nav li:last').css('border','none');
| ID | First Name | Last Name | Weapon |
|---|---|---|---|
| 1 | Indiana | Jones | Whip |
| 2 | Marion | Ravenwood | Frying Pan |
| 3 | Mutt | Williams | Switchblade |
td.highlight { background:#efaa42; color:#FFFFFF; }<td>...</td> <td class="highlight">...</td> <td>...</td>
table#highlight tr td:nth-child(2) {
background:#efaa42;
color:#FFFFFF;
}
$('table#highlight tr td:nth-child(2)').addClass('highlight');
a.external { background:url(../images/external.png) no-repeat right center; padding-right:16px; }<a class="external" href="http://atlantajones.com">...</a>
a[href^="http"] {
background:url(../images/external.png) no-repeat right center;
padding-right:16px;
}
$('a[href^="http"]').addClass('external');
a.pdf { background:url(../images/pdf.gif) no-repeat right center; padding-right:20px; }<a class="pdf" href="somefile.pdf">Download PDF</a>
a[href$="pdf"] {
background:url(../images/pdf.gif) no-repeat right center;
padding-right:20px;
}
$('a[href$="pdf"]').addClass('pdf');
input.btn { background:#efaa42; color:#FFFFFF; font-weight:bold; text-transform: uppercase; }<input type="text" value="" /> <input class="btn" type="button" name="submit" value="Submit Form" />
input[type="button"] { background:#efaa42; color:#FFFFFF; font-weight:bold; text-transform: uppercase; }also... input[type="text"] input[type="radio"] input[type="checkbox"]
$('input[type="button"]').addClass('btn');
Enter content by hand.
h3::before {
content: "My Great Blog :: ";
}
$('h3').prepend('My Great Blog :: ');

<img>...</img><br />Image Caption here
img.cover::after {
content: "<br /> " attr(alt);
}
$('img.cover').each(function() {
$(this).after('<br />' + $(this).attr('alt'));
});
The link looks like this when printed. (http://atlantajones.com)
Print page to see this link styled the same.
span.printlink {
color:#333333;
display:none;
}
@media print {
span.printlink {
display:inline;
}
}
a.print::outside::after {
content: "<span class='printlink'>" attr(href) "</span>";
}
$('a.print').each(function(){
$(this).after('<span class="printlink">
(' + $(this).attr('href') + ')</span>');
});