The Art and Science of CSS 98
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.
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).
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 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.
Learn CSS from a book? (Score:5, Insightful)
Re: (Score:3, Insightful)
Re:Learn CSS from a book? (Score:4, Informative)
For example, in the chapter on Backgrounds, the book points out the relatively limited browser support for the background-origin property.
In the chapter on forms, the book mentions that only in the latest generation of browsers can you actually style input elements by selecting for type (i.e. via CSS attribute selectors).
Although robust web development requires understanding the many browser quirks that abound, I can also understand the rationale behind the authors' approach in this book, which generally is implementation-agnostic.
They are betting that as time goes on, browsers will tend to converge to the spec, and antiquated browsers will represent less and less of the browser population. In other words, the book as written will only become more accurate with time (with respect to existing specs and browsers in actual use), while information about variations in today's browsers diminish to the status of curiosities.
Re: (Score:3, Informative)
Re: (Score:1, Offtopic)
Re:Learn CSS from a book? (Score:5, Insightful)
If you are one of those dweebs who just takes web templates without understanding how they work, then yes, you might not find the four column layout with double headers and pie menus that you so desperately think you need.
But, if you use those templates as I suspect they were intended, namely, to look at how they work, you can make your own design. Things like negative margins, auto margins, etc, may not be readily apparent if you have never seen them in use. But once you see them in practice, you should get all kinds of ideas on how to make them work for you.
If you want to be the sort of person who understands how these templates work, download them and play with the CSS. See what breaks it, see what makes it tick. That is how you become conversant with loads of neat CSS tricks. Pretty soon, you won't need those templates.
Re:Learn CSS from a book? (Score:5, Interesting)
Many templates on the web *are* really bad, but a quick visit to alistapart.com or csszengarden.com will give you some decent ones.
With all due respect to the people behind the CSS zen garden, it is most definitely not a good example of web design.
There's always been a contingent of web designers who hate new things coming along that they don't understand and don't want to learn. They dislike CSS for this reason (among other, more sensible reasons), and they rationalise this in a number of ways. At first it was lack of browser support. After browser support became more common, it morphed into the odd (if you know what you are doing) claim that it was impossible to create good-looking designs with CSS.
So along comes Dave Shea and sets up the zen garden, to which people contributed good-looking stylesheets. People were arguing for years that CSS meant boring designs, and the zen garden shut them up for good. Which was great, of course.
But don't for a second think that they are good examples of web design. They are not. Some of them are, of course. But the zen garden was an exercise in art, not design. Many of the zen garden designs look great, but are awful in terms of design. Remember that the difference between art and design is that design is supposed to be functional first and foremost. In this respect, many of the zen garden designs fail because they are unreadable, have awful contrast, are a pain to scroll, and all kinds of other mischief. But they look nice, and that was the point of the project.
If you are looking for ideas, then go ahead and use the zen garden for inspiration. But don't blindly follow what somebody has done and expect it to be good design, because there are many things that, if implemented on a real website, would utterly fail their visitors.
Re: (Score:2, Redundant)
Re: (Score:1, Redundant)
Re: (Score:2)
Try finding really good resources on liquid css tableless designs with code for cross browser support.
Yeah, I was trying to find a 3-column liquid CSS design the other day, and still can only find 1 that works [bridgew.edu] with any of the columns as the longest, and with background color extending all the way down. It's the same one I've found a few times, but surprisingly, I haven't found anyone else doing it.
Re:Learn CSS from a book? (Score:4, Insightful)
Re: (Score:3, Interesting)
BTW, too many coders consider themselves programmers...
Re: (Score:1, Informative)
Re:Learn CSS from a book? (Score:5, Informative)
Re: (Score:1)
Re: (Score:3, Insightful)
Re: (Score:2)
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).
While learning by doing may be the best way to learn, many still need a physical book they can use. I find it much easier to have a book I can look at, read, while I am working on something than not having anything. As for usng resources on the web, it's easier for me to have a printed page tha
Everyone's a critic. (Score:1)
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.
Re: (Score:2, Funny)
Re: (Score:2, Funny)
Your post (Score:5, Funny)
Your (Score:3, Funny)
Re: (Score:2)
I'd like to read the entire review, but I can't get a good sense of its quality from the parent post.
Re: (Score:1)
Cromar,
Thanks for the feedback.
This book really is more of a cookbook of sorts. I don't think it really teaches the intricacies of CSS, but helps extend CSS for those who are already very familiar with it. I definitely have some other books that I would recommend if you are interested in learning CSS.
This book was a quick read, and with multiple authors the chapters were not very lengthy. I tried to give a brief scan of each chapter with some insight to what the chapter covered. If I were to go into too
Re: (Score:1)
CSS gives me a headache (Score:4, Funny)
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 [sourceforge.net] is really nice for those of you who like editing their CSS by hand.
Re: (Score:1)
Re: (Score:2, Informative)
Check that place out. It'll render in all versions of IE, it's free, and it's reasonably fast.
IE6 and below *IS* a pain in the butt, I totally feel your pain. I've had many a (LITERAL) headache from wrangling the box model with its hacky display.
Re: (Score:2, Interesting)
http://www.microsoft.com/downloads/details.aspx?Fa milyId=21EABB90-958F-4B64-B5F1-73D0A413C8EF&displa ylang=en [microsoft.com]
Okay, it's a VPC image, but even if you're not able to run VPC then you can convert it to a VMWare image...
Easy solution (Score:4, Informative)
Re: (Score:2)
Re: (Score:2)
If even 5% of IE users disable Javascript, that's still a larger market share than the number three (Safari) and four (Opera) browsers combined.
Re: (Score:3, Insightful)
Re: (Score:2)
Re: (Score:3, Informative)
"Oh, high security? I'd better turn that on!"
Re: (Score:1)
CSS (Score:2)
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 [headfirstlabs.com] book to be a great introduction to CSS as well as XHTML.
Re: (Score:2, Informative)
Re: (Score:1)
Kevin,
Looking back at the review now I can see my abundance of deviations. I apologize for the interjections, and hope that you can look past that and still get some information from the review.
This helps me improve my writing of reviews - so I appreciate the feedback.
I haven't checked out the Head First book yet - but it does look like it would be a good starting point. I am at the point that with most of the CSS books I have read I start to see all of the overlapping. I like books that can bring some
Re: (Score:2)
Sorry if I came off snarky.
I mentioned the Head First book because it lays a necessary and solid foundation in XHTML and CSS and then leaves it up to the reader to explore the obscure corners of each
I don't need another CSS book (Score:5, Funny)
Word (Score:2)
Re: (Score:3, Insightful)
Re: (Score:2)
Am I the only one (Score:1, Interesting)
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
New: Download a hunk of HTML. Download a separate
Re: (Score:3, Insightful)
Re: (Score:2)
Re: (Score:3, Insightful)
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.
Wait, what ISP are you using that fails for one in twenty requests? Assuming an average of four external resources on a page (a low estimate for images alone), that means one quarter of all of your page loads are failing in some way already. Really?
New: Download a hunk of HTML.
Re: (Score:1)
Re:Am I the only one (Score:5, Insightful)
If the ISP flakes out 5% of the time, somebody needs a new ISP.
Caching CSS files and using CSS effectively can make the total code smaller and, since
'Javashit' is what allows web pages to function as cross-platform software applications without having to rewrite. Though coding for 5 web browsers at once is a bitch, it's a price I pay gladly.
Also, the evolution of the internet into 'efficiency' and 'efficacy' using javascript and CSS isn't nearly as big a problem as all the different browsers interpreting the code differently.
Christ, you have to upgrade to IE7 just to get transparent PNGs to work correctly (unless you work around [howtocreate.co.uk] it).
Uh in CSS you can change the sizes of items based on pixels and 'em' (not sure what that means). Basically, 'em' scales the dimensions based on font size, so you can zoom in on a page and have the elements change size as well.
As far as the new way of dealing with fonts and the problems with differing DPI's.. wouldn't that be the case in the old way as well?
Yeah, let's just go ahead and bitch about how people have multiple monitors and 30" displays now--things were so much better when 1024x768 was the biggest you had to worry about.
Also, having vector-based elements such as flash can up-scale sites to any resolution while keeping elements the same size (called resolution independence). Nobody seems to be doing much of that though.
Old way: Simple pages which take forever to load and have few fonts
New way: Complex pages which require good programmers to setup, some of whom are inconsiderate to users of rare resolutions/browsers.
Re: (Score:3, Informative)
Thus:
'1 em' is this wide: m
'3 em' is this wide: mmm
It's a pretty good metric.
Re: (Score:3, Informative)
Source: http://www.w3.org/TR/REC-CSS2/syndata.html#length- units [w3.org]
You're confusing em with ex, whereby 1ex == 1 x-height of the current font size at its current size.
Mod parent up - Informative. Stop modding GP. (Score:1)
Re: (Score:2)
Re: (Score:2)
'Javashit' is what allows web pages to function as cross-platform software applications without having to rewrite. Though coding for 5 web browsers at once is a bitch, it's a price I pay gladly.
While the rest of your rebuttal to the troll was spot on, this one is simply bullshit. Javascript allows for flashy cross-platform software applications. CGI was done long before AJAX, DHTML, and Javascript.
But I think that the point he was making was more that requiring Javascript just to pull down the right stylesheet sucks. There are lots of good reasons to disable Javascript (mostly security-based) and requiring it for site functionality sucks, particularly when all you're doing is displaying conten
Re: (Score:2)
Well, to start off, this website uses PNGs.
Transparent PNGs are AWESOME. They're they only way to overlay alpha graphics in web pages. They allow you to save time both in writing the page and loading it if you want to have a neat looking page.
Say you have a website with a repeating pattern for a background and you want a foreground image to perfectly blend in with that background. Without transparent PNGS, you can use GIFs--whose pi
Re: (Score:1)
Christ, you have to upgrade to IE7 just to get transparent PNGs to work correctly (unless you work around it).
Yeah, if only transparent PNGs worked correctly in IE7, that would be true.
To list 3 of the (for me) most annoying issues with transparent PNGs in IE7 (I can probably think of about 10):
1) Transparent PNGs (image tag, not background) of 1x? can rotate CCW 90 degrees for no apparent reason. This will cause other transparent PNGs to not be shown at random (some will, some wont). (NB: This seems to be a Vista specific IE7 problem, it does not happen on XP SP2)
2) Same PNG construct as (1) absolutely positi
Re: (Score:2)
What's IE6 % now? I think it was 50% of browsers last time I checked.
Re: (Score:2)
Re: (Score:2, Insightful)
CSS brings an amazing number of options to the table, and it most certainly does not limit your ability to make a site that is very accessible. Sure, the ability to change so many options does incur a greater possibility of someone making a mistake - but that's not the problem with CSS, that's a problem with the person writing CSS.
You are right about CSS making web-dev much easier for those writing the code. For the same reason that OO is nice, the separation of th
You forgot... (Score:5, Insightful)
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.
Re: (Score:2)
This is a bad example, because there is a tag/attribute combination in HTML4 to apply attributes to an entire column in a table. Example: <col align="center">
Not sure you're actually familiar with CSS (Score:2)
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
Re: (Score:2)
Javashit is still a security risk, but we'll make damn sure that none of our content renders correctly unless you turn it on
That's not really a problem related to css. You should rather blame those using JS to solve browser issues. If you need seperate stylesheets for Firefox and IE you can use comments:
Firefox won't load it, but it recognizes import (as opposed to IE). Of course this is not really the most beautiful way to do it, but it avoids CSS hacks and
Re: (Score:1)
The only issue I have with conditional comments is that they are proprietary to MS and they are embedded in the markup. In most cases I will have a default.css, which in turns uses @import for my typography, color, layout, reset, and hacks. Yes, I compress and combine when necessary. However, as much as I hate hacks - I would rather manage hacks in a separate stylesheet, then add extra markup that was given to use by Microsoft due to their crappy support.
So, while it is a solution - I would rather manage a
Re: (Score:2)
Re: (Score:2)
I'm working with CSS for years and yes I'm sick of it. But I'm more sick of your short post, than my years of CSS.
That should speak volumes. There's basically almost nothing correct in there, and if there is, it's well hidden between a myriad of wrong assumptions, outright lies and poor understanding of web technology. Sucks for you.
Re: (Score:1)
Seriously, the problems you described echo of my experience six years ago when we had Netscape 4 and IE5. A lot of plain bad designers were trained back then and if you visit the sites they design now, yeah, you're going to run into the same experience. The good designers use ems and grid layouts for sizing, specify font-families nor use JS browser detection for stylesheet loading.
Re: (Score:1)
Re: (Score:2)
but thanks: i didn't think such a drastically bad understanding of how HTML/CSS works was possible. i stand corrected.
Re: (Score:1, Insightful)
Wasn't Xforms suppose to take care of this?
No. XForms separates the form's data model from the markup. It allows you to mark up forms as you see fit, rather than grouping them into one element arbitrarily. It's a similar effect to the separation of content and presentation that CSS allows, but smaller in scope and applied to a different area.
Re: (Score:1, Insightful)
Re: (Score:2)
Notable absence (Score:1)
Re: (Score:1)
I liked the approach (Score:2)
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 s
CSS - isn't that for DVDs (Score:1)
Re: (Score:2)
http://www.myspace.com/canseidesersexy [myspace.com]
Hope this helps.