Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Sams Teach Yourself HTML and CSS In 24 Hours

samzenpus posted more than 4 years ago | from the read-all-about-it dept.

Book Reviews 107

r3lody writes "Sams Teach Yourself HTML and CSS in 24 Hours 8th edition, by Julie C. Meloni and Michael Morrison, provides the beginning and intermediate web designer with the tools needed to create standards-based web sites. The major focus of the book is XHTML 1.1 and CSS 2, but HTML 5 and some XHTML 1.0 are discussed. Overall, the presentation and content are very good. One small minus was that the publisher's site did not include downloadable examples from the book. I also found no errata until the latter parts of the book. Published in December of 2009, the 8th edition provides reasonably current information." Read on for Ray's review.Each "hour" of the book includes a "What You'll Learn in this Hour" section at the beginning, and Q&A, Quiz and Exercises sections at the end. Most chapters also include a "Try It Yourself" section, indicating what you should be accomplishing with your own web site. The examples have color coding for the various tags, comments, etc., and the book's examples work with a number of browsers. Specifically, Apple Safari, Google Chrome, Microsoft Internet Explorer, Mozilla Firefox, and Opera browsers were used to test the examples. If you use the coding standards espoused in the book, your web pages should appear properly formatted across most computers. Handheld browsers are only covered briefly, in the section discussing media-specific style sheets.

Overall, the book is divided into five parts: Getting Started on the Web, Building Blocks of Practical Web Design, Advanced Web Page Design with CSS, Advanced Web Site Functionality and Management, and Appendixes.

Part I: Getting Started on the Web provides the customary introductory material, suitable for beginning users. After describing the seemingly obligatory "history of the web", the first hour concludes with discussions of how to choose a web hosting provider – a topic rarely covered in the books I've read. The second hour teaches how to get web pages uploaded to a web server using FTP, and how to distribute content in a file-based structure without a server. The next two hours then cover the basics of XHTML 1.1 and CSS 2. For both XHTML and CSS, very clear instructions on how to validate your coding help insure that your pages follow the standards.

The next 9 chapters comprise Part II: (Building Blocks of Practical Web Design). This part goes into detail regarding web page coding. Starting with text alignment using paragraph tags and lists, the book has a good collection of text formatting tips using CSS as the preferred style methodology. Tables and links are covered in the next two chapters at a pretty standard level. I found the chapter on using color had a lot of good information, but I believe a beginning user would find it somewhat confusing – especially when hexadecimal notation is introduced.

The next three chapters of this part of the book cover images and multimedia. I liked the focus on getting the right sizing for photos and banners, and the tutorial on how to place the images on the web page (including wrapping text, image maps, and clickable images). I was disappointed in the limited coverage of tiling and GIF animation. The multimedia chapter was a pleasant addition – one I have rarely seen in web design texts. The discussion was tilted toward Microsoft technology, so my testing worked properly only under Internet Explorer at first, however I finally managed to get Firefox to deal with the embedded object. Some information was given for embedding YouTube links, also. I would have liked to have seen more information on the parameters for the WMP object coding. The last chapter in Part II covers frames – both framesets and iframes – with only basic information.

Advanced Web Page Design with CSS is the main topic of Part III. These six chapters dig into the important aspects of CSS alignment. One chapter focuses entirely on margins, padding, alignment and floating, and provides a nice introduction to the full discussion of the CSS box model in the next chapter. Reformatting lists was the principal target of the next chapter, leading to a discussion of navigation bars (horizontal and vertical) in the chapter after that. This is where I started picking up on some irregularities that escaped a review. For example, even though this was supposed to be standard XHTML, I noticed some list item ending tags missing from the examples. Granted, browsers still display the list properly, but this should have been caught before printing.

The last two chapters in this part cover modifying text display using mouse actions, and fixed versus liquid layouts. I liked the mouse techniques to modify a displayed image based on which thumbnail image the mouse is over. It's a simple little method that looks very nice on the page. The liquid layout chapter gave me some problems at first. My attempts didn't work the same under different browsers at first, but when I went back over them while writing the review, they worked just fine. I'm still at a loss to understand what was wrong, so I suspect those starting out may have a similar experience.

The final major part, Advanced Web Site Functionality and Management, wraps up some miscellaneous issues. First, they cover how to create a modified CSS profile to make the web page more print-friendly. The next chapter provides an introduction to JavaScript. Unfortunately, this is where I found some more non-standard XHTML code. Web-based forms are covered only at a high-level in hour 22. The authors do provide examples of each type of form field, with CSS code to neaten up the page, but it appears to be a very cursory handling of the topic.

The final two hours go over the basics of keeping your web site organized, and how to publicize the site on major search engines. The book wraps up with a final part for the two appendixes, containing useful links to further information and a general XHTML and CSS reference.

Teach Yourself HTML and CSS in 24 Hours appears to be a properly authoritative text that would help you create a standards-based web site. Like most texts of this type, it does not reference web design software such as DreamWeaver. Rather, it addresses understanding exactly what code standards-based browsers will handle, and how you can manipulate them to create exactly what you want. The two main disappointments with the book are the obvious errors in the later chapters, and the lack of downloadable examples from the publisher's web site. That said, the content is so worthwhile, I rated it an 8 out of 10.

You can purchase Sams Teach Yourself HTML and CSS in 24 Hours (8th edition) from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

Sorry! There are no comments related to the filter you selected.

would be nice if .... (-1, Flamebait)

Anonymous Coward | more than 4 years ago | (#30984326)

mainstream web hosters provided HTML and CSS support in the first place. google sites has dumbified HTML down to its template builder and geocities is offline, facebook has its own templatified crap, so has myspace and flickr/twitter etc all use their own non HTML required templates.
HTML is obsolete. like plumbing. for the mainstream.

Re:would be nice if .... (0, Insightful)

Anonymous Coward | more than 4 years ago | (#30984382)

Only for those too stupid to learn it - which is a good thing. Sandbox the idiots and keep them as far away from HTML as possible; that way the web will not look like MySpace.

Re:would be nice if .... (3, Interesting)

tthomas48 (180798) | more than 4 years ago | (#30984932)

In defense of HTML and CSS, MySpace was not really what I'd imagine the web would look like. MySpace only lets you insert HTML and CSS via what is essentially an injection attack. Tumblr let's you rewrite the entire page and I see plenty of tumblr blogs that look just fine.

I learned it ... (0)

neonprimetime (528653) | more than 4 years ago | (#30984348)

... in 2 hours, without the book!

Re:I learned it ... (0)

biryokumaru (822262) | more than 4 years ago | (#30984404)

Ya, I saw the title and I thought "Really? That seems a bit long..."

Re:I learned it ... (0)

Anonymous Coward | more than 4 years ago | (#30984864)

Welcome to the latest Slashvertisement.

Re:I learned it ... (4, Funny)

QRDeNameland (873957) | more than 4 years ago | (#30989554)

Ya, I saw the title and I thought "Really? That seems a bit long..."

Well, we all know that /. is way too advanced of an audience for this book. Wait for the review of the upcoming SAMS title: "Teach Yourself Writing Self-Aware Device Drivers with Brainfuck in 17 Minutes".

Re:I learned it ... (4, Insightful)

rgo (986711) | more than 4 years ago | (#30984822)

Maybe in 2 hours you learned the very basics, like changing fonts and colors. Learning how to do complex layouts will take you a much longer time, due to broad scope of CSS (CSS 3 is massive) and because every browser implements CSS differently.

Re:I learned it ... (1)

orsty3001 (1377575) | more than 4 years ago | (#30984900)

This book will teach you HTML and CSS in 941 24 hours sessions.

Only 24 hours? (4, Informative)

XxtraLarGe (551297) | more than 4 years ago | (#30984380)

I haven't been able to pull an all-nighter since college (though I've come close playing Civ or Starcraft), but I'll give it a try!

More likely, they mean "Teach yourself HTML/CSS in 24 1 hour lessons" or something like that. I found I was able to learn the basics of HTML & CSS in about an 8 hour day. The problem is the moving target HTML has become over the years, though even that is a minor adjustment. I think this type of books is probably o.k. for most people, but it would be better if they used a free resource like W3 School's free tutorials [w3schools.com] .

Re:Only 24 hours? (4, Informative)

sakdoctor (1087155) | more than 4 years ago | (#30984564)

The hard part of CSS was keeping track of, in exactly which manner, IE6 fucked it up.
Now that the holy Google has given us all permission to drop IE6, into flaming animated .gif after-life for bad browsers, CSS just got a whole lot easier.

http://www.quirksmode.org/css/contents.html [quirksmode.org]

Re:Only 24 hours? (1)

gander666 (723553) | more than 4 years ago | (#30984598)

Amen brother. Scream it from the rooftops.

Re:Only 24 hours? (1)

Foolicious (895952) | more than 4 years ago | (#30984890)

Mod insightful, interesting, obvious genius, whatever. Do so with all your might. Countless hours wasted dealing with IE6. And just recently, too.

Re:Only 24 hours? (1)

causality (777677) | more than 4 years ago | (#30986070)

Mod insightful, interesting, obvious genius, whatever. Do so with all your might. Countless hours wasted dealing with IE6. And just recently, too.

If it can be proven that IE's incompatibility with open standards is an intentional design decision on Microsoft's part (shouldn't be hard), then I'd love to see a legal precedent where every Web developer and/or their employers can send Microsoft a bill for the extra and otherwise unnecessary work. That'd be the way to end this practice.

Re:Only 24 hours? (0)

Anonymous Coward | more than 4 years ago | (#30993872)

Are you retarded? Serious question.

Re:Only 24 hours? (4, Insightful)

Shados (741919) | more than 4 years ago | (#30984962)

IE6 was the worse, but pretty much all browsers screw(ed) up pretty badly at one point or another. And HTML/CSS leaves a lot of the default implementations to the browser developers, so while there are many "implicit" agreements between Firefox, Safari, and even IE, they're not part of the standards. So its still a moving target. I remember back in the days of Firefox 3.0 (which isn't long ago in human years, but feels like forever ago in Web years). I would systematically assume that Firefox was right, and IE was not.

Until I hit display:inline-block, which at the time IE got right on SOME stuff, and firefox never got right at all. Took me a while to figure that one out :) (Its been fixed since then, but...)

Re:Only 24 hours? (3, Informative)

Bogtha (906264) | more than 4 years ago | (#30986328)

Until I hit display:inline-block, which at the time IE got right on SOME stuff, and firefox never got right at all. Took me a while to figure that one out :) (Its been fixed since then, but...)

That's because inline-block was originally a proprietary Internet Explorer property. It was added to CSS 2.1 years later, at which point the other browsers implemented it.

Re:Only 24 hours? (2, Insightful)

fm6 (162816) | more than 4 years ago | (#30988232)

IE6 was the worse, but pretty much all browsers screw(ed) up pretty badly at one point or another.

True. Back when Netscape still dominated the browser market, they took a lot of flack for their private extensions to HTML.

And HTML/CSS leaves a lot of the default implementations to the browser developers, so while there are many "implicit" agreements between Firefox, Safari, and even IE, they're not part of the standards.

The vagueness is by design. You can't specify exactly what a given element will do, because there are all kinds of factors you don't know anything about: resolution, display size, color depth, etc. Unfortunately, most web designers still don't get this. Instead of learning the official description of an object, they just look at the way it's rendered on their particular setup and say, "Oh, that's what it's supposed to do."

Re:Only 24 hours? (1, Interesting)

Monkeedude1212 (1560403) | more than 4 years ago | (#30984596)

Exactly. Some guys I know go "What do you mean I shouldn't be using Tables to layout my page?" because thats basically how it was done a long while ago. (Long in computer years, not human years).

Learning HTML and CSS are the easy parts of Web Design, and could easily be done in less than a day (I know I learned it pretty quickly). It's when you want to embed some other controls, or add some functionality, that web pages actually get complicated (Why isn't my PHP communicating with mysql properly?!?!?). Or even *shudder* when the client requests for something done in Flash.

Re:Only 24 hours? (2)

Bluesman (104513) | more than 4 years ago | (#30984948)

So what IS the alternative to a relatively scaled HTML table in CSS that works across all browsers?

As of a few years ago, I found none.

Re:Only 24 hours? (0)

Anonymous Coward | more than 4 years ago | (#30985652)

The alternative, correct way of doing things (CSS) has certainly been a viable option for more than a few years (I know from having coded such 8 hours a day for more than a few years). It does require some learning, though, to get all browsers display it correctly.

That is the difficult part. I find it extremely funny when people who have never designed weblayouts for living say "What? That's so easy to learn!" after having coded a few lines of HTML for their personal homepage at some point. Or edited complete layouts. It's like me saying "I did take a course of Assembly in college and managed to code a program... Assembly programming is fast to learn. :) Who needs books?"

And no, tables are not even a viable alternative. There are numerous reasons for why the enterprise level websites need to be coded semantically. Search engine visibility, accessability for visually impaired, easier parsing if necessary, etc. etc.

Tables are totally viable (1)

weston (16146) | more than 4 years ago | (#30990840)

And no, tables are not even a viable alternative. There are numerous reasons for why the enterprise level websites need to be coded semantically.

This is false, if popular.

The first clue should be the existence of screen readers and the widespread effectiveness of Google even before going way back before CSS (much less CSS positioning) was in common use. Heck, even Lynx had some surprisingly effective ability to filter out layout tables and still display tabular data as early as 1999. If layout-repurposed table markup made those things truly difficult, then 90% of the web would have been opaque to those things until around 2005.

The thing is, it's really not that hard to tell the difference between table markup used for layout and used for data most of the time. A good HTML hand-coder could probably tell the difference nearly instantly. A piece of software could probably do it for the vast majority of cases with a set of heuristics a half a page long. And they do.

Re:Only 24 hours? (1)

Yold (473518) | more than 4 years ago | (#30988858)

see liquid layout

There Isn't One (1)

weston (16146) | more than 4 years ago | (#30990726)

So what IS the alternative to a relatively scaled HTML table in CSS that works across all browsers?

There isn't one. Not really. Not yet.

A couple of people will show up and tell you that there is. I've spent five solid years implementing hundreds of arbitrary layouts mocked up in Illustrator. I worked hard to use CSS positioning and semantic markup whenever possible, probably know the craft better than most. And the conclusion I've come to is that even where the methodologies and hacks and workarounds can get the job done, CSS positioning still sometimes sucks. Partly because there are some semi-frequent cases where table cell behavior makes your life easier, partly because it's a pretty natural layout metaphor people have used for a long time before we even had liquid screen media.

display: table-cell and friends are just about ready for prime time, though. That'll probably take care of some of the hard cases, and work for a lot of people as a metaphor, largely because we'll essentially be writing table markup again.

Re:Only 24 hours? (2, Interesting)

MisterZimbu (302338) | more than 4 years ago | (#30984990)

I'm still a tables guy- to me, doing anything remotely complicated in CSS is completely unintuitive and backwards, and requires ridiculous hacks before you even get to IE (no vertical alignment? lack of proper columns?). The real problem with web layouts today is that neither HTML Tables nor CSS were designed with layout in mind, so everything requires far too much effort to set up properly. To me, I'd rather deal with the (much smaller) hassle of using tables for layout than deal with the significant hacks to get around the severe limitations of CSS.

Hopefully when CSS3 gains some more widespread acceptance and some of the layout-oriented modules (the CSS3 table ascii-art module and/or the Flex Layout module) gain some traction, I'll be able to switch over.

Re:Only 24 hours? (1)

Luyseyal (3154) | more than 4 years ago | (#30985600)

We write a lot of forms code here with table-ish output. I use a mix of table and div code to make things work reasonably. It's pretty fast and you can CSS the stuff you need to but still guarantee columns will line up the way they should.

Love the "CSS is awesome" mug someone else posted.
-l

Re:Only 24 hours? (1)

MisterZimbu (302338) | more than 4 years ago | (#30985976)

This is more or less what I do. The tables I make typically aren't 5-level nested monstrosities with spacer gifs and col/rowspans all over the place. It's usually only one or two levels deep, with the content placed into properly-styled DIVs with margins and paddings as appropriate.

It doesn't work perfectly (the DIVs wont grow vertically in any browser as they shouldn't, and the DIVs won't grow horizontally in IE6/7 with table cells like they should), but I refuse to deal with hacks like 100% heights, +1000000 paddings with -1000000 margins, and having to overflow a margined div to get clears inside the div to work properly and just accept that scrollbars will randomly pop up.

Re:Only 24 hours? (1)

Luyseyal (3154) | more than 4 years ago | (#30986312)

They probably should include a spreadsheet layout mode in CSS. Even if it still included all that ugly mess you have to do at least it could do some of it for you -- in the background where it belongs. That would make my life a ton easier. More than half of our applications are glorified interactive spreadsheets. I also wouldn't cry if they managed a way to append data column by column instead of <tr>, <tr>, <tr>...

-l

Re:Only 24 hours? (2, Interesting)

Blakey Rat (99501) | more than 4 years ago | (#30985252)

Ok, I consider myself a pretty sharp guy, and I've been working with the web for ages, but I still can't use CSS without running into major problems every single time. Some of them are design issues, some of them are just me not being able to wrap my head around it.

For example, CSS doesn't have variables... so you can't say something like "headerColor = #5444BB" and just use that wherever you want the header color. What were they thinking!?

CSS also can't do math, so a simple construct like "width = 10px + 5em" is impossible. (You can't do this without math because the number of pixels in an em can change based on browser/font settings.) What were they thinking!?

The first thing I need in my CSS site is columns, you know, like newspapers had in the 17th century. What? You mean CSS has no support for columns until version 3, which is only now beginning to get any browser support at all? The only way to get columns is kludgy workarounds. What were they thinking!?

Design issues aside, I usually end up with a page where there's a completely unexplainable pixel gap, or an element wrapping when it shouldn't, or some thing or another. Usually, the only way I can solve these problems amounts to, basically, guess and check... maybe I'm an idiot, but the way CSS does layouts just won't fit in my head at all.

Obligatory link to "CSS is awesome" mug: http://www.zazzle.com/css_is_awesome_mug-168716435071981928 [zazzle.com]

Re:Only 24 hours? (1)

joss (1346) | more than 4 years ago | (#30985658)

Amen.. make a multilevel pure css combination drop down/fly-out menu that works in IE5.5 up. Its less intuitive than programming in brainfuck. Other people's perl will give it a run for its money though.

Re:Only 24 hours? (1)

mikael_j (106439) | more than 4 years ago | (#30986736)

Of course, most of us barely bother to support IE6 (and that's mostly a "well, let's make sure they can at least view the site" effort) because pretty much any browsers of that era had serious issues with rendering anything properly.

At work I'm in charge of a website which has a 500+ line file called "ie6screen.css", the entire purpose of this file is to make IE6 behave somewhat properly. And this isn't even counting all the CSS in the regular stylesheets (for all browsers) that's been tweaked and messed with just so it won't break IE6/7 in some strange way.

The main impediment to trouble-free XHTML/HTML5 + CSS development is IE in general and IE6 more specifically. No sane web developer bothers testing in IE5.x anymore much like you won't find anyone testing their site in NS4.x or that it renders fine in 640x480, hell most developers have finally managed to give up on 800x600 as well and are targeting 1024x768 and above (really, if your desktop machine or netbook isn't capable of 1024 pixels horizontally it's time to take the plunge and leave the mid-90s already).

/Mikael

Re:Only 24 hours? (4, Insightful)

djheru (1252580) | more than 4 years ago | (#30985748)

quote: For example, CSS doesn't have variables... so you can't say something like "headerColor = #5444BB" and just use that wherever you want the header color. What were they thinking!?

That's what css classes are for:
CSS - .blueHeader { color: #5444BB; } .redHeader { color: #BB4445; }

HTML -
I'm Blue
I'm Red

Re:Only 24 hours? (1)

Blakey Rat (99501) | more than 4 years ago | (#30986876)

Ok, let's say classes solve all problems with color duplication. Wouldn't the CSS be a heck of a lot easier to read if your #5444BB had a more friendly name? Maybe you're an expert at looking at hex colors and instantly figuring out what they look like, but I sure as hell ain't. There's more than one advantage to having variables.

Re:Only 24 hours? (1)

djheru (1252580) | more than 4 years ago | (#30987612)

That doesn't make any sense. You still have to assign the value to the variable. The value is going to be a hex number. You don't have to use hex colors, if you want to limit yourself to the color names that css recognizes, but the point of creating a class like .redHeader is so you can set the color values once and then forget them, using the people friendly class names instead. You can create as many classes as you want and name them things like .redHeader, .darkRedHeader, .reddishOrangeHeader, etc. In the end, you are communicating with a computer. It's not the fault of css that browsers use hex to render colors. But if it helps, just remember that the first two digits are red, the next two are green, and the last two are blue. So #5444BB is mostly blue with some red and slightly less green mixed in.

Re:Only 24 hours? (1)

Blakey Rat (99501) | more than 4 years ago | (#30987832)

That doesn't make any sense. You still have to assign the value to the variable.

Well, obviously.

The value is going to be a hex number. You don't have to use hex colors, if you want to limit yourself to the color names that css recognizes,

Again, duh. The problem is that nobody uses the built-in colors. (Which is just as well, since only like 8 of them are defined in the standard-- the rest Microsoft put in IE, and other browsers just kind of ran with IE's color list.)

In the end, you are communicating with a computer. It's not the fault of css that browsers use hex to render colors.

Yes, but the computer is there to make our lives easier. If it takes the computer 0.2 milliseconds to figure out that #113366 is the header color, and it takes me (a lousy human being) 5 seconds to reach the same conclusion, I want to assign that color a readable name, damnit.

(The assumption here is that CSS was created to make our lives easier; I'm not sure that's true.)

Look, I'm not some kind of "CSS King" with all the answers, so maybe I'm way off-base here.

All I know is that in my job, I frequently see other people's CSS files. And in almost every case, I'll see the same hex color used in a half-dozen cases in the CSS file with absolutely no indication of what that string of hex actually means from a practical perspective.

Maybe this is what I'm missing in your explanation: is it possible to assign a CSS class to CSS rule in the stylesheet itself? Like "inheriting" the other class's properties? If that's the case, then apologies-- but I didn't know that was possible.

Re:Only 24 hours? (0)

Anonymous Coward | more than 4 years ago | (#30992750)

You're missing the point. You want a variable, but the class takes on its role. One way or another, you're going to have to define the color in hex mode.

Re:Only 24 hours? (1)

Blakey Rat (99501) | more than 4 years ago | (#30994498)

One way or another, you're going to have to define the color in hex mode.

Duh. Stop repeating that, I'm not a retard, and I'm not saying otherwise.

What I'm saying is that in a single CSS file, you should only see a particular hex color *once*. *Ever.* And that one time? You should be assigning it to a friendly human-readable name. A well-designed language would allow this, CSS doesn't.

In my job, I see tons of CSS files from tons of different web designers. Almost in all cases, the same hex color is seen 3, 4, 5, 10 times in the same document. There should be no need for that, it does nothing but main the CSS harder to maintain-- I should be able to change all 10 of those color references to a different color by changing one line, not 10. Again: a well-designed language would allow this.

Or take another example, maybe I want to put the amount of padding in a variable because I have 27 different tags that need padding-- it's always the same amount of padding, but I might want to change the amount. Right now, I have 27 different CSS rules, each one containing the same "padding-left: 15px" entry... to universally change that to 20px, I have to change it in 27 different places!

I think people who work a lot with CSS develop some kind of Stockholm Syndrome and they become completely unable to grasp it's horrible shortcomings. I find it hard to believe that people are disagreeing with my basic point: CSS should have variables in it.

Re:Only 24 hours? (0)

Anonymous Coward | more than 4 years ago | (#30987878)

But since we have classes, why can't we have inheritance? It would be so nice to define for example .smallFont { 0.7em sans-serif }, then define .smallRedFont < .smallFont { color: red }. I made up the syntax but you get the point. I'm aware that an element can have multiple CSS classes, but it would be nicer to be able to inherit properties from other classes, not just parents of the element. In that example it doesn't really make much of a difference, but instead of using <a class="ui-state-default ui-corner-all myCustomButton"> to get a "button" styled to match jQuery UI, one would be simply able to define .myCustomButton < ui-state-default, ui-corner-all { /* custom definitions here */ }.

Re:Only 24 hours? (1)

djheru (1252580) | more than 4 years ago | (#30989146)

The reason is that it's better to favor composition over inheritance. In any relatively complex website, the scheme you describe would become unwieldy. It is better to assign general characteristics to outer elements, and then get more specific and you get deeper into the DOM (as a general rule). At least that's how I do it. I am really one of that hated breed, the PHP "developer" (although I do real languages as well), and 90% of what I do uses Zend framework, but I make it a point to have my css cascade intelligently instead of defining a bunch of classes with redundancies. Also, blueprint css helps a lot.

Re:Only 24 hours? (1)

ianezz (31449) | more than 4 years ago | (#30988932)

That's what css classes are for:

They may be how they are used, but that's not how they were meant to be used, the idea being that CSS classes mark content, while CSS deals with presentation. Classes as "blueHeader" are no better than a <font> tag; things get interesting when you want to make all the "blueHeader" content red, for example.

Re:Only 24 hours? (1)

djheru (1252580) | more than 4 years ago | (#30989020)

I personally don't use them that way either, I was speaking to his specific point of having "variables" to store color values. You wouldn't want to use specific attributes like colors in your class names.

Re:Only 24 hours? (1)

Blakey Rat (99501) | more than 4 years ago | (#30994980)

Look, forget classes. I think you bringing up classes has clouded the issue. I'm saying I should be able to write a CSS file like this (syntax pulled out my ass):

@headerBGColor = #442299;

#topHeader { background-color: @headerBGColor; }
#topHeaderLogo { background-color: @headerBGColor; } .headerFont { font-size: 16px; background-color: @headerBGColor; }
#footer { background-color: @headerBGColor; }

See? Now the mysterious hex value have a friendly, human-readable, name. Now I can change it in 4 places by changing a single line in my CSS file. Now I'm not going to see the value #442299 further down the file, and have absolutely no clue what color it is or why it's there.

On the other hand, you're saying I can do something like this:

.redColor { background-color: #442299; }

#topHeader { .redColor; } // assign the redColor class to the #topHeader rule
#topHeaderLogo { .redColor; }

And I'm saying that doesn't work.

You claimed to be a PHP programmer in another post... so the concept of variables and naming global values and avoiding "magic numbers" in code should be old-hat to you, right?

Do you really, really believe that CSS doesn't need improved in this area? I really find it hard to believe that anybody defends CSS... it's a shitty language. The three shortcomings I mentioned above (no variables, no math, no columns) are only the most blatantly obvious of the shortcomings, there are so many more:

How about the fact that CSS can be embedded in a HTML file, yet has completely different and unique rules for comments than HTML or Javascript has? Is // a comment? How about /* */? How about <!-- -->? WHO KNOWS!

How about the fact that CSS properties all have two different names, some of them conflicting with reserved Javascript keywords? From the CSS file, it's background-image. From Javascipt, it's element.style.backgroundImage. Why does the same property have two names?! Now think about what happens with the "float" value-- that's a TYPE in Javascript for fuck's sake! WHAT WERE THEY THINKING!?

How come when you read from the element.style.whatnot value from DOM/Javascript, it doesn't have any of the inherited styles in it? Only the styles directly placed on the element? (Yes, I know, they added the getComputedStyle() function, but that's a fucking hack!)

I mean, CSS is shit. That's really par for the course for the web. (HTML is shit, too. As is XHTML. And don't get me started on DOM...) What REALLY boggles my mind is how many people defend CSS as being some kind of holy grail of holiness.

(Also, Slashdot, why do I have to use HTML entities for "<!-- -->" when my post is in Plain Old Text mode? You suck.)

Re:Only 24 hours? (1)

djheru (1252580) | more than 4 years ago | (#30987828)

Use Blueprint CSS http://www.blueprintcss.org/ [blueprintcss.org] It will make your life much easier. Every website I make has columns. They really aren't that hard.

Re:Only 24 hours? (1)

Boba001 (458898) | more than 4 years ago | (#30990090)

Although CSS still fails to support variables and simple math, there are some CSS frameworks available that can be used with most web development platforms to offer that and additional functionality (like mixins) for the developer. Take a look at:

Re:Only 24 hours? (1)

b4dc0d3r (1268512) | more than 4 years ago | (#30985648)

The current hotspot is now having a footer at the bottom which:
-Floats at the bottom of the page, regardless of how little content there is
-Expands down the page when content overflows, so it doesn't cover content.
-Reacts when you do things like hide/show content.

So many different ways to do it, all with little quirks. Bottom line, CSS is designed as a system of browser HINTS which the browser uses to determine how content is laid out when the window changes size/shape. It has some hacks for specifying specific layouts, but it is absolutely not browser-based. It is more oriented towards print layout, where the output size is static. You can make some great layouts if you make assumptions about the size, but they break as soon as you re-size the window. Flow and float and similar ideas upon which CSS is based tend to really mis-align what you intended.

I'm still using tables for certain things, and I'll never give it up until CSS is replaced by something oriented towards browser layout.

Re:Only 24 hours? (1)

GigaHurtsMyRobot (1143329) | more than 4 years ago | (#30991372)

I've not come across one layout design that I couldn't implement in tables and have it function properly cross-browser. Look at how much whining was done in this thread about CSS and IE6... I never had to deal with any of that shit. Nested tables make the most logical sense for the amount of effort, and if you do it right, there's a lot of time saved in 'the old fashioned way.'

Re:Only 24 hours? (1)

GigaHurtsMyRobot (1143329) | more than 4 years ago | (#30991380)

I also use div's and asynchronous javascript (without shitty xml)

Re:Only 24 hours? (1)

lena_10326 (1100441) | more than 4 years ago | (#30993936)

I'm sick of these table debates so let's cut to the chase. The answer is CSS is deficient so sometimes tables are needed but they should be avoided where possible. Pass this answer around so we can stop these stupid, incessant CSS versus HTML table debates and retarded generalizations such as "you should never use tables" comments.

Re:Only 24 hours? (1)

moteyalpha (1228680) | more than 4 years ago | (#30984666)

That is my suggestion also, W3 . I addition I would recommend firebug. https://addons.mozilla.org/en-US/firefox/addon/1843 [mozilla.org] There is no better teacher than seeing how the scripts are actually implemented.

Re:Only 24 hours? (5, Informative)

fm6 (162816) | more than 4 years ago | (#30987154)

You young folk don't know how good you've got it. I cut my teeth doing all-nighters at the campus computer center, that being the only way to get decent turnaround on the 360 mainframe. (Don't know what I'm talking about? Google "batch processing" and "IBM cards".) With that training, I was able to pull all-nighters well into my 40s. Though it wasn't nearly as much fun by then — everybody else was gone by 6, the wimps.

The w3schools.com is very impressive. Not only do they provide a huge amount of well-written content, they have these cool web apps that let you fiddle with code and see the results immediately. I've never worked through any of their tutorials, but when I google for information on some HTML or CSS feature, I end up on w3schools.com about 75% of the time. That should tell you something.

W3.org is also a valuable resource. They are, after all, the authoritative source for HTML, CSS, and lots of other web technologies. Two pitfalls: their target audience is implementers and standards wonks, not web developers; and you have to watch out for features that never got implemented.

Despite these issues, it's really a good idea to write web code that targets the W3C specs rather than specific browsers. That way you'll have web pages that work on most browsers and don't break whenever somebody tinkers with Gecko or Trident.

Re:Only 24 hours? (0)

Anonymous Coward | more than 4 years ago | (#30990078)

everybody else was gone by 6, the wimps.

Everybody else probably had a wife and kids waiting back at home. Your work doesn't love you, can't comfort you, and won't remember you when you're gone...

Re:Only 24 hours? (0)

Anonymous Coward | more than 4 years ago | (#30995144)

was it in the snow uphill both ways?

Re:Only 24 hours? (0)

Anonymous Coward | more than 4 years ago | (#30987980)

Yeah, all those teach yourself X in 24hrs state in the book that it's 24 1hr lessons.

Why type? (-1)

Anonymous Coward | more than 4 years ago | (#30984428)

Does anyone still type in HTML or CSS anymore? Don't you just bring up a WSYWIG designer and just publish your page?

I mean, Please! This is the 21st century wtf are we still typing for christ-sakes?!

Re:Why type? (3, Insightful)

Captain Splendid (673276) | more than 4 years ago | (#30984604)

Does anyone still type in HTML or CSS anymore? Don't you just bring up a WSYWIG designer and just publish your page?

I mean, Please! This is the 21st century wtf are we still typing for christ-sakes?!


This is why. [little-gamers.com]

Re:Why type? (2, Insightful)

dubbreak (623656) | more than 4 years ago | (#30985814)

Does anyone still type in HTML or CSS anymore? Don't you just bring up a WSYWIG designer and just publish your page? I mean, Please! This is the 21st century wtf are we still typing for christ-sakes?! This is why. [little-gamers.com]

Dreamweaver is more aptly called nightmare weaver. Quick and dirty one up static page? Sure use WYSIWYG. Editing something existing with well thought out hand written CSS? Forget it, you are just going to screw things up.

Of course static hand created webpages in this day are the real WTF. For anything more complicated than a few pages it makes a lot more sense to run a CMS. Design the template once properly so it looks correct on the major browsers and let users change the content via the CMS. No luser should ever be FTPing anything to or from the site and the "web master" of past should not longer exist to shuffle changes on a website. It's not the 90's anymore. We have great (and free!) tools to manage creating, editing and publishing content on websites.

Re:Why type? (1)

bigjarom (950328) | more than 4 years ago | (#30986964)

I took notes during MBA school in html -just to make boring classes less boring.

Re:Why type? (0)

Anonymous Coward | more than 4 years ago | (#30984642)

<html>
<head>
  <title>Reply</title>
</head>
<body>
  <h1>Yes</h1>
  <i>Does anyone still type in HTML or CSS anymore?</i>
  <p />
  <b>As a matter of fact, I do type everything in HTML.</b>
</body>
</html>

Re:Why type? (0)

Anonymous Coward | more than 4 years ago | (#30984798)

No doctype declaration.
Neither your i nor b tags are inside of a block level element.
Use strong instead of b tag.

Re:Why type? (1)

trapnest (1608791) | more than 4 years ago | (#30984904)

You're missing your opening paragraph tag.

Re:Why type? (0)

Anonymous Coward | more than 4 years ago | (#30985112)

You're missing your opening paragraph tag.

No. The tag is simply empty. It creates a new line.

Re:Why type? (2, Insightful)

Pojut (1027544) | more than 4 years ago | (#30984786)

I certainly don't do html hard coding anymore, but back in the day when I was in middle school ('95-'98) learning HTML from a couple of books, I did everything in notepad. There is no way I would hard-code an entire website nowadays, but I'm glad I started with the straight coding...it has made learning PHP MUCH easier.

Re:Why type? (1, Insightful)

Anonymous Coward | more than 4 years ago | (#30985024)

If you to be one of those persons who use WYSIWYG editors to carve your HTML/CSS then in order to find out why you shouldn't use one of those then simply pick up any document you've created with your editor of choice and open it with a text editor. The amount of useless cruft that it creates will blow your mind. And more to the point, if you don't know HTML and/or CSS and rely on a WYSIWYG tool then no matter how pretty your doc appears to be, you still don't have a clue about what you are doing. And that tends to be useful if you do that professionally.

Re:Why type? (0)

Anonymous Coward | more than 4 years ago | (#30986398)

As a matter of fact, yes we do.

All our templates are done with a simple text editor. And our customers appreciate standards-compliant front-ends.

Misinfromation in 1st Chapter (4, Informative)

acoustix (123925) | more than 4 years ago | (#30984608)

I found this while previewing the book on Amazon's website: "Suppose you want to do a Google search, so you dutifully type http://www.google.com in the address bar"..."Your web browser sends a request for the index.html file located at the http://www.google.com/ address"

While it's not the end of the world, it certainly is an error that will misguide a beginner on how traffic is exchanged between a browsing client and the web server. The web browser does not assume index.html. That is the job of the web server to assign a default document whether its index.html, default.htm, index.php, or yourmama.html.

Re:Misinfromation in 1st Chapter (0)

Anonymous Coward | more than 4 years ago | (#30984748)

whether its index.html, default.htm, index.php, or yourmama.html

This is your mother speaking, you insensitive clod! Dinner will be ready at 6!

Re:Misinfromation in 1st Chapter (5, Informative)

DavidD_CA (750156) | more than 4 years ago | (#30985622)

That is the job of the web server to assign a default document whether its index.html, default.htm, index.php, or yourmama.html

I sent a request for yourmama.html last night, and it was 200 OK.

Re:Misinfromation in 1st Chapter (1)

sslayer (968948) | more than 4 years ago | (#30986276)

How come this comment's got modded Informative? Can I metamoderate that as funny?

Re:Misinfromation in 1st Chapter (5, Informative)

andi75 (84413) | more than 4 years ago | (#30986410)

+1 funny mods don't give karma points to the author. To work around this, the moderators decide to

- mod moderately funny jokes as funny
- mod great jokes as informative or insightful

The practice is widespread and metamods generally agree with it (I think, at least I still get mod points...).

Re:Misinfromation in 1st Chapter (0, Redundant)

Victor Liu (645343) | more than 4 years ago | (#30986576)

A mod of Funny doesn't give the submitter any karma. For generosity, some people mod funny posts as Informative or Insightful.

Re:Misinfromation in 1st Chapter (2, Insightful)

Anonymous Coward | more than 4 years ago | (#30986282)

I would have gone with "402 Payment Required"

Re:Misinfromation in 1st Chapter (5, Funny)

Bogtha (906264) | more than 4 years ago | (#30986412)

I can't reproduce that. I keep getting 413 Request Entity Too Large instead.

Re:Misinfromation in 1st Chapter (0)

Anonymous Coward | more than 4 years ago | (#30987238)

> I sent a request for yourmama.html last night, and it was 200 OK.

I sent one to my ex, and got 301 Moved Permanently

Re:Misinfromation in 1st Chapter (0)

Anonymous Coward | more than 4 years ago | (#30987580)

417 Expectation Failed

/offtopic, so mod appropriately (-1, Offtopic)

Pojut (1027544) | more than 4 years ago | (#30984736)

I've been wanting to learn a new language just for the hell of it, and I've consistently heard that Ruby on Rails is fairly easy to pick up and get started with. Anyone have any suggestions for good books written for Ruby noobs? Thanks!

Re:/offtopic, so mod appropriately (-1, Flamebait)

Anonymous Coward | more than 4 years ago | (#30984924)

I've consistently heard that Ruby on Rails is a slow piece of shit mired in needless complexity.

Fixed.

X in 24 hours (5, Informative)

QuoteMstr (55051) | more than 4 years ago | (#30985268)

Doesn't everyone know that X in 24 hours books neither teach you X, nor do it in 24 hours? They're super low-end guides generally that contain outdated information that could just as easily have been gleaned from tutorials. Meh.

I can't believe Slashdot ran an ad^H^H^H^H review of this book.

Re:X in 24 hours (1)

fprintf (82740) | more than 4 years ago | (#30985724)

Kindof like the for dummies books? Well, except I have found quite a few "for dummies" books that have been extraordinarily helpful. I have a "Learn C in 24 hours' by Jesse Liberty that I bought many years ago. This is the kind of book that is routinely derided by those knowledgable in the subject. And yet, it was enough to get me started, and enough to get me to the right forums to learn the right way of doing things. I am forever grateful that I picked up that book at a bookstore and it got me further down the road than I was getting using the online documentation of the time (e.g. DJGPP free compiler, I think). Perhaps this book will get some enterprising young adult started in the right direction, enough to become a webmonkey and learn on slashdot that webmonkeys get no respect and they should then learn a real language.

Re:X in 24 hours (1)

bladesjester (774793) | more than 4 years ago | (#30987020)

I have to agree with you. I don't get the hostility toward "Teach yourself X" books. They're a great place to start.

Granted, there are a number of crappy ones out there, but a lot of them are great as intro tutorials (and some even serve well as refs)

Re:X in 24 hours (2, Insightful)

west (39918) | more than 4 years ago | (#30986330)

I hadn't realized that *literally* judging a book by its cover gets you moderated 'Informative'. It will be interesting to see how the parent rates versus postings that actually address the content of the book.

Re:X in 24 hours (1)

rrohbeck (944847) | more than 4 years ago | (#30987064)

Ha! I learned C++ in 24 hours and now I write security sensitive applications!

Re:X in 24 hours (1)

Ryiah (1324299) | more than 4 years ago | (#30990232)

They're super low-end guides generally that contain outdated information that could just as easily have been gleaned from tutorials.

Don't think of it as Sams being slow. Think of them as giving Internet Explorer a chance to at least partially support CSS before the book ships.

Re:X in 24 hours (1)

Eil (82413) | more than 4 years ago | (#30990816)

The 24 hours thing is just a gimmick. Like O'Reilly books, the quality depends on the author. I've used these Teach Yourself books in the past to come to speed quickly on various topics and generally they work well for that. Yeah, some really suck. And none are designed to be a comprehensive education, but for some quick cramming, they work fine.

Why XHTML? (2)

Kozz (7764) | more than 4 years ago | (#30985736)

A case against XHTML [hixie.ch]

Not only is it possibly harmful to send XHTML (xml) as text/html, all your style and script blocks need to be wrapped in all kinds of comment / (P)CDATA silliness to truly validate correctly, etc. Read the article and you may decide that HTML 4 (strict) is the way to go.

On the other hand, if someone would like to refute the points in the link above, I'd welcome an alternate perspective.

Re:Why XHTML? (1)

mikael_j (106439) | more than 4 years ago | (#30987002)

The only reason we send XHTML as text/html at all is because a certain browser doesn't understand application/xml+xhtml and some turnkey firewall boxes insist on every application/whatever MIME-type being "teh ewul exxxe filez of pr0n and virooseses!!1".

As for XHTML being stricter than HTML 4, that's a good thing IMO.

/Mikael

Re:Why XHTML? (2, Interesting)

Blakey Rat (99501) | more than 4 years ago | (#30987540)

The big problem with XHTML is that the W3C was wasting their time with this format that offers dubious benefit, made browsers more complicated, on the assumption that older versions of HTML would just... I dunno... magically go away. (At which point, browsers could be made simpler again.) Oh, and of course they didn't bother to figure out what actual websites on the actual Internet need, so it's incompatible with a ton of hugely popular tags. (For example, Atlas Universal Action Tags don't validate in XHTML Strict.)

Oh boy. I can do a XLST transform on my homepage. That gets me... what exactly?

Not that I'm really that opposed to XHTML, what pisses me off most is that they were working on this useless thing when they could have been actually working on HTML5 in the first place.

"Sams" is All I Needed to Know (3, Interesting)

mikestew (1483105) | more than 4 years ago | (#30985802)

I think I've learned more from Sams books by fixing the numerous bugs in the sample code than reading the text.

Re:"Sams" is All I Needed to Know (1)

FiloEleven (602040) | more than 4 years ago | (#30986298)

Seriously. Any book whose title neglects the apostrophe to denote possessive case can't be very reliable. And Sam doesn't even have any qualifications!

Straight? (1)

kenh (9056) | more than 4 years ago | (#30985884)

Or am I supposed to take breaks (meaning it will actually take more than 24 hours ;^)?

perhaps for aspiring web _developers_ (1, Insightful)

Anonymous Coward | more than 4 years ago | (#30986140)

Web design is wholly different than HTML + CSS development.

Re:perhaps for aspiring web _developers_ (0)

Anonymous Coward | more than 4 years ago | (#30987542)

Web design is wholly different than HTML + CSS development.

Indeed, just as architecture is wholly different from plumbing, masonry, carpentry, and electrical wiring.

That said, I'd prefer to hire an architect who knows something about plumbing, masonry, carpentry, and electrical wiring.

Julie C. Meloni-Department of English-Wash. St. (1, Informative)

Anonymous Coward | more than 4 years ago | (#30987152)

Meloni is an English teacher!

Superb Owl (0)

Anonymous Coward | more than 4 years ago | (#30987700)

Can I call it a "Superb Owl" party?

Re:Superb Owl (0)

Anonymous Coward | more than 4 years ago | (#30989550)

> Can I call it a "Superb Owl" party?

Wrong article, knucklehead!!

Two minor corrections... (2, Informative)

r3lody (800999) | more than 4 years ago | (#30988092)

Two minor corrections: (1) The downloadable content is available. The publisher's had a glitch on their web site that has since been corrected (but not until after I had finished the review - oh well!) If you go to http://www.informit.com/title/0672330970 [informit.com] and click the Download tab, you'll get it. (2) The link for purchasing goes to the 7th edition. This is the 8th edition, and the link to that book is http://www.amazon.com/Sams-Teach-Yourself-Hours-Coverage/dp/0672330970/ref=sr_1_1?ie=UTF8&qid=1265061056&sr=8-1 [amazon.com] .

1999 called ... (1)

icepick72 (834363) | more than 4 years ago | (#30988836)

... and it wants its book back.

When HTML 5 is out (1)

stimpleton (732392) | more than 4 years ago | (#30989524)

When HTML 5 is out there will be no "Teach yourself HTML 5 in 24 hours".

I have been reading the HTML 5 discussion docs at WHATWG [whatwg.org]

Here is one DOM of one element:

interface HTMLDataListElement : HTMLElement {
readonly attribute HTMLCollection options;
};

"Teach yourself a half dozen HTML5 Elements in 24 hours - Part 1 of 50/Series 1 of 200)"

Teach yourself anything (well) in 10 years (1)

unchiujar (1030510) | more than 4 years ago | (#30992772)

Whenever I see titles like these ( Teach yourself X in ZY [days|hours|minutes|seconds] ) I always think of this article http://www.norvig.com/21-days.html [norvig.com]

Accessibility? No? Didn't think so... (1)

Grismar (840501) | more than 4 years ago | (#30993282)

There's so many books out there that tell you how to write decent HTML+CSS that this seems superfluous, especially considering all its shortcomings. One glaring omission is the lack of attention for accessibility. Many web developers will do just fine writing a new page for some mom-and-pop shop or other small business but once you start writing for government or large business, lack of knowledge about stuff like WCAG can be crippling. It's mostly a matter of avoiding bad habits and learning some best practices and I feel any book on this topic should include it.
Load More Comments
Slashdot Login

Need an Account?

Forgot your password?