The Art and Science of CSS
nateklaiber writes "The Art and Science of CSS was a quick read (208 pages) and packed full of valuable code examples. Unlike other CSS books that teach you the specifics of CSS with vague examples (not vague in a bad way), this book teaches you specific examples and gives you extra resources. This book is somewhat of a cookbook of commonly used CSS methods. Each author brings their unique writing style to the table, and each chapter focuses on a specific aspect of design and its CSS and styling methods." Read below for the rest of Nate's review.
The Art and Science of CSS
author
Jonathan Snooks, Steve Smith, Jina Bolton, Cameron Adams, David Johnson
pages
208
publisher
Sitepoint
rating
5/5
reviewer
Nate Klaiber
ISBN
0975841971
summary
This book is a cookbook of commonly used CSS methods.
Chapter 1 starts with Headings. The author of this chapter gives a brief introduction to hierarchy and branding, and how you can achieve more control with your look and typography. As typography is discussed, he moves on to talk about image replacement and the many techniques available to us today. There is no perfect solution when it comes to image replacement, but the author does a great job of showing current methods, their advantages, and their disadvantages (including an in-depth section on sIFR).
Chapter 2 is all about Images. The author starts by showing you how to create a basic but aesthetically pleasing image gallery. The task at hand is to create the enlarged version, the thumbnail page, and the galleries page while keeping the markup lean and semantic. Each of these are put together very nicely with flair not usually seen in off the shelf image galleries. The author also discusses how to create images (in context) with captions, including a nice use of transparent PNGs. The authors creative use of captions give you options outside of the box (both semantically and philosophically) of normal captions that are seen all around the web.
Chapter 3 shows us that backgrounds don't have to be boring. This is a very simple chapter that discusses backgrounds of the past (repeating pictures, large pictures, etc), and then looks forward to the present in getting creative with your backgrounds. He uses a case study as an example, and it shows specifics of positioning and layering.
Chapter 4 jumps into Navigation. Different types of navigations are discussed (vertical, horizontal, tabbed, variable width, etc) and shown with specific examples. The author shows how to take from each of those to create advanced navigation systems using images and your semantic markup. I think that from this chapter a user could create an advanced navigation simply because the foundation is set pretty solid before he gets to the advanced section. This chapter goes hand-in-hand with chapter 1 when talking about image replacement.
Chapter 5 discusses the dreaded (sometimes feared) Forms. Forms come in all shapes and sizes and it is up to us to build them accordingly with the user in mind. The styling in this chapter spruces up what is a rather mundane form while giving you great flexibility and hooks to extend yourself. The author discusses the several different layout types (top aligned label, left aligned label, right aligned label) and shows how to enhance each. If you work with forms often, this chapter will help you whip up a clean interface for the task.
Chapter 6 is everybodys favorite chapter Rounded Corners. The author gives you an arsenal of tools (and knowledge) to attack the task of adding rounded corners. He discusses the different methods (horizontal stretching, vertical stretching, and full flexibility) and shows you how to achieve each keeping in mind the task of keeping the markup minimal and meaningful. We also get a brief glimpse into what CSS3 will have to offer us with multiple backgrounds per element.
Chapter 7 closes out the book with Tables. Tables still have a strong place in web development and the author shows you how to use tables properly (with semantic markup) and then how to give them a little visual jump-start and interaction. The markup presented here helps you give clear meaning to your tables as well as building with accessibility in mind (which is always important with tables, specifically). We round off the chapter looking at some interaction enhancements via Javascript that we can use with our tables (sorting, striping, and hovering).
Overall I found this book to be an excellent read. It was short and to the point, and gives the reader a great starting point (as well as inspiration). The book itself is well designed. My only qualms with the book is that the code examples are listed in full in many places, which gives less room for content related to the chapters. As I said in the beginning, this was a fairly quick read but well worth it. I would say that this is for an intermediate CSS developer, as specific CSS is not discussed in great detail but given to you as a way to achieve a specific design task. If you are familiar with CSS and need a quick way to achieve the tasks listed above, then this book is perfect for you.
You can purchase The Art and Science of CSS from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
Chapter 2 is all about Images. The author starts by showing you how to create a basic but aesthetically pleasing image gallery. The task at hand is to create the enlarged version, the thumbnail page, and the galleries page while keeping the markup lean and semantic. Each of these are put together very nicely with flair not usually seen in off the shelf image galleries. The author also discusses how to create images (in context) with captions, including a nice use of transparent PNGs. The authors creative use of captions give you options outside of the box (both semantically and philosophically) of normal captions that are seen all around the web.
Chapter 3 shows us that backgrounds don't have to be boring. This is a very simple chapter that discusses backgrounds of the past (repeating pictures, large pictures, etc), and then looks forward to the present in getting creative with your backgrounds. He uses a case study as an example, and it shows specifics of positioning and layering.
Chapter 4 jumps into Navigation. Different types of navigations are discussed (vertical, horizontal, tabbed, variable width, etc) and shown with specific examples. The author shows how to take from each of those to create advanced navigation systems using images and your semantic markup. I think that from this chapter a user could create an advanced navigation simply because the foundation is set pretty solid before he gets to the advanced section. This chapter goes hand-in-hand with chapter 1 when talking about image replacement.
Chapter 5 discusses the dreaded (sometimes feared) Forms. Forms come in all shapes and sizes and it is up to us to build them accordingly with the user in mind. The styling in this chapter spruces up what is a rather mundane form while giving you great flexibility and hooks to extend yourself. The author discusses the several different layout types (top aligned label, left aligned label, right aligned label) and shows how to enhance each. If you work with forms often, this chapter will help you whip up a clean interface for the task.
Chapter 6 is everybodys favorite chapter Rounded Corners. The author gives you an arsenal of tools (and knowledge) to attack the task of adding rounded corners. He discusses the different methods (horizontal stretching, vertical stretching, and full flexibility) and shows you how to achieve each keeping in mind the task of keeping the markup minimal and meaningful. We also get a brief glimpse into what CSS3 will have to offer us with multiple backgrounds per element.
Chapter 7 closes out the book with Tables. Tables still have a strong place in web development and the author shows you how to use tables properly (with semantic markup) and then how to give them a little visual jump-start and interaction. The markup presented here helps you give clear meaning to your tables as well as building with accessibility in mind (which is always important with tables, specifically). We round off the chapter looking at some interaction enhancements via Javascript that we can use with our tables (sorting, striping, and hovering).
Overall I found this book to be an excellent read. It was short and to the point, and gives the reader a great starting point (as well as inspiration). The book itself is well designed. My only qualms with the book is that the code examples are listed in full in many places, which gives less room for content related to the chapters. As I said in the beginning, this was a fairly quick read but well worth it. I would say that this is for an intermediate CSS developer, as specific CSS is not discussed in great detail but given to you as a way to achieve a specific design task. If you are familiar with CSS and need a quick way to achieve the tasks listed above, then this book is perfect for you.
You can purchase The Art and Science of CSS from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
I'm really not sure that a printed paper book is the proper way to learn CSS methodologies. There are so many resources on the web now, and "learning by doing" helps the content stick much better (in my opinion).
Good opening and closing paragraphs, but the descriptions of the chapters are somewhat repetitive and without much actual content.
I would like to know more about CSS, but I can't get a good sense of the quality of this book from the review.
Not the actual CSS which is, with five minutes of practice, very easy to use. Much better than tables all over the place. The headache comes from IE dang 6 and below.
Since I can't legally test in IE6 (no Windows license, and browsershots.org takes a 4 hour round trip for Windows screenshots) making IE6 specific tweaks is a pain in the backside. I'll finish up eventually I'm sure, in the mean time I plan to just turn off CSS for those users.
As a side note CSSED is really nice for those of you who like editing their CSS by hand.
Think of the Children; Sleep with your Sister
Was anyone else (I'm talking to you Slashdot) put off by the reviewers writing style (you know what I'm talking about)? I found it hard to read (especially considering the length of the post) when he kept deviating (yes, deviating!) from his review by interjecting his comments (and numerous they were) into the post.
On topic, I found that the Head First XTHML book to be a great introduction to CSS as well as XHTML.
What I need as a 4'x2' poster (or possibly a flashing neon sign) saying: "You CAN NOT use // comments in CSS".
ccalam - acoustic versions of new songs.
CSS seems to be nothing more than a way of making life easier for Webmasters, while making life suck for the actual consumers of web content.
Old: Download a hunk of HTML. Browser renders it. If the ISP's spotty (maybe the setup of that HTTP transaction fails 5% of the time), then one out of 20 times you don't get any HTML to render. So you reload and all's well. .css file, or two, or three, or four, sometimes from the same server, other times from some other server. If the ISP flakes out on you 5% of the time, and you have 5 different files to download, then (.95^5 = 0.76) about one time out of four, you get nothing, and have to reload.
New: Download a hunk of HTML. Download a separate
Old: Javashit is a security risk.
New: Javashit is still a security risk, but we'll make damn sure that none of our content renders correctly unless you turn it on, because how else are we going to run our browser-detection script that determines which of the half-dozen stylesheets (see above) we want your browser to use.
Old: Any font you like, as long as it's Helvetica, Courier, or Times Roman. But it'll be the version of Helvetica, Courier, and Times Roman that your OS designers knew would look good with its engine, at the sizes that look good on your display device.
New: Any font you like, as long as you're running the same DPI on your monitor as the web designer was running on his screen. If not, it'll look about two sizes too small, or two sizes too large. But it'll never look like the "right" default font that the pre-CSS browser would default to.
Seems like we'd just gotten away from "This Site Best Viewed At 800x600"... only to get back to "This Site Best Viewed At Two Font Sizes Smaller on 96-DPI monitors running at 2048x1536, Because The Web Designer Built It On A 72DPI monitor, But The Other Guy's Websites All Have To Be Two Font Sizes Smaller on 72-DPI 21-inch monitors running at 1280x960 Because The Website Designer Had A 2048x1536 96DPI monitor When He Wrote It".
The point of CSS was to get away from that bullshit, not make it more firmly-entrenched.
"Chapter 5 discusses the dreaded (sometimes feared) Forms. Forms come in all shapes and sizes and it is up to us to build them accordingly with the user in mind. The styling in this chapter spruces up what is a rather mundane form while giving you great flexibility and hooks to extend yourself. The author discusses the several different layout types (top aligned label, left aligned label, right aligned label) and shows how to enhance each. If you work with forms often, this chapter will help you whip up a clean interface for the task."
Wasn't Xforms suppose to take care of this?
They forgot to remind everyone to run with their knives out.
"Always forgive your enemies; nothing annoys them so much." - Oscar Wilde
I admit I'm a bit of a hack, helping someone out with a web site, and a c++ coder by day... yeah... all of a sudden sh*t stops working, and I didn't edit the code! I just added comments! wtf... 20 minutes later I figure it out. Sadly this happens multiple times :P
Cromar's post makes a good point. It is concise and understandable, though well over half the post is one big sentence fragment. Overall, I'd say it's worthwhile reading for anyone who is thinking of reading Nate Klaiber's review.
Patrick Doyle
I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
if you've got half a brain then go learn flash/flex2.
bit more tricky than css but then it isn't crap.
end of.
It's not always "exactly as seen in Windows", but you can get 90+% there before sending your page off for rendering.
Write your pages for mostly-standards-compliant browsers, then use http://dean.edwards.name/ie7/ to make them look right in IE. Sure, your pages will take an extra few tenths of a second to render in IE, but it saves you hours of fucking around to make it look right.
Old: Spend literally days planning and laying out tables so that you can make sure stuff is lined up correctly and (gasp!) maybe put a menu on the left or something.
New: Assign it a CSS attribute and call it done.
Old: Want to change the font of your site? Go through Each. And. Every. Single. Page. and change it.
New: Change one line in one file.
Old: Create HTML files that were several kilobytes worth of extraneous #@$*! attributes do the most minor of things. Want the data in a table centered? Be prepared to modify hundreds (thousands?) of td tags. (Even programmatically, this is stupid.)
New: Define the attribute once in one place and have it apply to the whole file.
Old: Everyone who wanted to display anything meaningful on the web had to be an HTML coding expert as well as a design expert.
New: There's a pretty good division of labor that will if desired, allow the designers to be designers and the developers to be developers.
Old: Every browser had its own standards of how tags and their attributes were interpreted.
New: Every browser still has its own standards of how tags and their attributes are interpreted, but it's a lot better and tons more consistent than it used to be.
Old: 99% of all web sites looked the same, like crap, because although lots of people kinda sorta knew HTML, coding a site consistently pretty was a lot of time and effort, most of the time, prohibitively much.
New: Lots of sites still look like crap, but at least they're their own unique brand of crap. Seriously, web sites have gotten generally much prettier, and most importantly, easy to use because of CSS and, yes, Javascript. Simple example: I use Gmail as my e-mail client now. Without CSS and Javascript (and a related subject, AJAX), there wouldn't be a chance in hell of using a web application as my e-mail client. And before too long, it looks like Google is going to have some really nifty other office-type applications. And Google's not alone.
I could go on, but do I really have to?
Look, CSS isn't perfect, there still needs to be some work done both by the W3C and especially the browser developers to make it reach its ultimate goal of separating content from presentation. But the fact that it has a few downsides doesn't take away from how much better the world of the web is now than it used to be.
It ain't perfect, and in fact, in some cases, it's a pain, but your points don't seem like the reasons why.
.css file, or two, or three, or four, sometimes from the same server, other times from some other server. If the ISP flakes out on you 5% of the time, and you have 5 different files to download, then (.95^5 = 0.76) about one time out of four, you get nothing, and have to reload.
CSS seems to be nothing more than a way of making life easier for Webmasters, while making life suck for the actual consumers of web content.
Actually, sometimes it makes life *harder* for webmasters, especially if they've drunk the table-free layout kool-aid.
If the ISP's spotty (maybe the setup of that HTTP transaction fails 5% of the time), then one out of 20 times you don't get any HTML to render. So you reload and all's well. New: Download a hunk of HTML. Download a separate
Don't know which ISP you're using, of course, but I'm not even sure I see anything like this even 1% of the time for CSS. And seeing css files loaded from other servers? Also rare. And you get the advantage that layout/styling code put in the css file only has to be loaded once.
New: Javashit is still a security risk, but we'll make damn sure that none of our content renders correctly unless you turn it on, because how else are we going to run our browser-detection script that determines which of the half-dozen stylesheets (see above) we want your browser to use.
Are people really using Javascript detection? Most of the discussion and practice I'm familiar with focuses on:
(a) Using filter hacks to target browser specific CSS (sparingly)
(b) Making sure the actual content of the page is viewable/readable even if the stylesheet isn't used for some reason.
New: Any font you like, as long as you're running the same DPI on your monitor as the web designer was running on his screen. If not, it'll look about two sizes too small, or two sizes too large. But it'll never look like the "right" default font that the pre-CSS browser would default to.
CSS can be used to fix fonts at the wrong size. It also has all the tools for picking font sizes the old method had and a few new ones with relative sizing merits.
Now, I think CSS is a pain for layouts. For some reason, the observation that there's a use for semantic tabular markup seems to have blinded the w3c and others involved to the fact that tables are a great tool/concept for layout. The differences IE has from the spec are a royal pain (though I have to say that IE6's box model actually makes more sense than the CSS 2.1 spec's, so much so that I'm glad they didn't use follow spec there, and the day I can actually choose it via CSS 3 won't be a moment too soon). The fact there's no easy CSS way to center an item in a container element sucks (and please don't point me to the hacks that require knowing the height of either element or javascript stuff). Waiting until css 3 to allow multiple background images on an element was shortsighted. I could go on.
However, I'd rather have all of this than go back to HTML 3.2. The markup is cleaner and easier to edit, it's genuinely smaller, it's easier to make global changes, and some layout and decoration tasks are just, plain and simple, easier because of it. Remember the days where if you wanted a bordered box you had to barf out a 9-celled table?
<div style="border: 1px solid gray"> content here </div>
over:
<table border="0" cellspacing="0" cellpadding="0">
<tr><td bgcolor="gray"> </td> <td bgcolor="gray" height="1"> </td> <td bgcolor="gray"> </td></tr>
<tr><td bgcolor="gray" width="1"> </td> <td> content here </td> <td bgcolor="gray"> </td></tr>
<tr><td bgcolor="gray"> </td> <td bgcolor="gray"
Tweet, tweet.
The guys name is Jonathan Snook, not Snooks. Snooks sounds like a tasty treat!
"Christ, you have to upgrade to IE7 just to get transparent PNGs to work correctly (unless you work around [howtocreate.co.uk] it)."
And just how many websites use transparent PNGs (let alone PNGs in general)?
I just finished reading the book today. I haven't tried implementing the stuff in it yet but I'm excited about some of it.
What I really liked about the book is how they specifically discussed how different browsers (Firefox, Opera, Safari, IE6, IE7) react to the code and how to make their tricks work across them in spite of most issues. They show example renderings for the different browsers at intermediate stages of some of the design work and explain what's going on and what it will take to fix it for a specific browser (almost always IE).
I've read CSS books in the past that showed me some cool trick I wanted to do and then it took me forever to find (on my own) some way to get it to work across the browsers I was interested in. (or else I gave up trying)
If 'the people' in Amendment 2 are 'the state' then Amendments 1, 2, 4, 9, and 10 benefit the state, not you.
I hope the book tells us what CSS stands for, cause the review sure didn't! Seriously, there are two common uses of CSS here on SlashDot. Why not tell us which one it is?
Graham
I feel that p3d0's post is perfectly understandable, though the author nit-picks at Cromar's post in a way some might find natty and irksome. I would recommend it to anyone thinking about reading Cromar's post.
"You can either have software quality or you can have pointer arithmetic, but you cannot have both at the same time."
I stand corrected. Thanks for the correction, and may you be favorably moderated. :)