- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
'Redudant'. I like it. Dudeness roolz.
But I like the tag names. Of course, a nitpicker would like the names to reflect 'why' rather than 'what', but I'm sure that some tag out there exists that maps one to the other, like:
Important { ItalicsRed }
(Or however CSS actually works - I apologise for not looking it up right now.)
Admin
If this person(top example) is a programmer, I would love to see their variable naming convention.
Reminds me of that great post with the awsome const declarations
Const int ONEPLUSTWO = 1+2
Admin
Yeah -- us nitpickers are throwing fits about now. The idea of CSS is to separate semantics (the markup) from appearance. There's nothing wrong with classing -- making one set of <em> elements appear different from another, for instance -- but there IS a problem with this approach. Let's say you want to change the appearance of the page. With "meaningful" classes, you'd make the <p> elements in your intro block, say, a nice mauve on a beige background (don't laugh, it can happen) merely by changing the style sheet. The problem is that your 80% -height mauve Verdana is occuring in paragraphs that are clearly marked "smallishGreenComicSansWithABlackBackground". Right now, that's a View->Source WTF. Next time a change rolls around, somebody (probably not the original designer) has to try and figure out what's what -- do I make the red green ones purple, or was it the blue yellow bold ones italic white?
Admin
So, did anyone else notice that "largerBoldGreen" doesn't actually bold the text? I guess "Bold" is merely describing the color green.....
Admin
This is the "classic" first style sheet for any designer that has just started using css. It takes most people a long time to be convinced that content descriptive styles, like articleTitle are better then style descriptive titles like normalBlackArialItalic.
Admin
I wonder how he would name floats? ;)
Admin
It should be noted that there's no way in CSS to write smallishBlueTahomaBold { /* inherit from smallishBlueTahomaNormal */ font-weight: bold;} so that it actually works like the comment suggests.
Admin
iHaveNoClueWhatImDoingButSomeTimesItGoesRightAndNowItsGreenToo {
float: right;
font-color: green;
}
Admin
Let's give the b tag guy some credit.. Maybe he heard that it's more recommended to use the STRONG tag instead of B, so he thought the B tag was on it's way to deprecation very quickly. Then he decided to get his page covered for when that happens.
Admin
Notice the lack of "." at the beginnings of the definitions. This doesn't look like bad class naming in HTML, it's bad tag naming in XML.
Admin
CSS uses some relatively complicated weighting rules for deciding whether a user's CSS, the browser's CSS, or the author's CSS is used. "b { font-weight: bold; }", is, to be fair, completely reasonable and completely justifiable, albeit I would expect it to be written "b { font-weight: bold !important; }".
What could be considered unreasonable is using CSS to style pre-CSS elements. ;)
Admin
You can achieve this like this though:
#smallishBlueTahomaNormal, #smallishBlueTahomaBold
{
font-family: Tahoma, sans-serif;
color: blue;
}
#smallishBlueTahomaBold
{
font-weight: bold;
}
Cheers,
Andre
Admin
.smallishBlueTahoma {font-size:small; color:Blue; font-family:Tahoma;}
.Bold {font-weight:bold;}
<P class="smallishBlueTahoma">same as smallishBlueTahomaNormal</P>
<P class="smallishBlueTahoma Bold">same as smallishBlueTahomaBold, but inherits from smallishBlueTahomaNormal.. well, sorta</P>
Admin
Oh god, you're right. Even worse.
Admin
Strictly-speaking, B *is* a pre-CSS element.
Admin
<FONT style="BACKGROUND-COLOR: #efefef">Where are the stinking commments? I needs some stinky comments like this Css has!</FONT>
<FONT style="BACKGROUND-COLOR: #efefef"><FONT color=#008000 size=2>/* Page Title */
</FONT><FONT color=#800000 size=2>.t5Title</FONT><FONT size=2> {</FONT><FONT color=#ff0000 size=2>font-family</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>Geneva,Verdana,sans-serif</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>font-size</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>24.5px</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>color</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>#ffffff</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>line-height</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>25px</FONT><FONT size=2>; }
</FONT><FONT color=#008000 size=2></FONT><FONT color=#800000 size=2>.t5SubTitle</FONT><FONT size=2> {</FONT><FONT color=#ff0000 size=2>font-family</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>Geneva,Verdana,sans-serif</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>font-size</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>14.5px</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>color</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>#ffffff</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>line-height</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>17px</FONT><FONT size=2>; }
/* General Blue (Dark Sky) */
</FONT><FONT color=#800000 size=2>.t1</FONT><FONT size=2> {</FONT><FONT color=#ff0000 size=2>font-family</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>Geneva,Verdana,sans-serif</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>font-size</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>11px</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>color</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>#005588</FONT><FONT size=2>; }
</FONT></FONT><FONT style="BACKGROUND-COLOR: #efefef"><FONT color=#008000 size=2></FONT><FONT color=#800000 size=2>.t1Sml</FONT><FONT size=2> {</FONT><FONT color=#ff0000 size=2>font-family</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>Geneva,Verdana,sans-serif</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>font-size</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>9.5px</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>color</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>#005588</FONT><FONT size=2>; }
</FONT><FONT color=#800000 size=2>.t1Lrg</FONT><FONT size=2> {</FONT><FONT color=#ff0000 size=2>font-family</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>Geneva,Verdana,sans-serif</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>font-size</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>13px</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>color</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>#005588</FONT><FONT size=2>; }
</FONT><FONT color=#800000 size=2>.t1Big</FONT><FONT size=2> {</FONT><FONT color=#ff0000 size=2>font-family</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>Geneva,Verdana,sans-serif</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>font-size</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>14.5px</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>color</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>#005588</FONT><FONT size=2>; }
/* html */
</FONT><FONT color=#800000 size=2>A:link</FONT><FONT size=2> { </FONT><FONT color=#ff0000 size=2>font-family</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>Geneva,Verdana,sans-serif</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>color</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>#005588</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>text-decoration</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>underline</FONT><FONT size=2>; }
</FONT><FONT color=#800000 size=2>A:visited</FONT><FONT size=2> { </FONT><FONT color=#ff0000 size=2>font-family</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>Geneva,Verdana,sans-serif</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>color</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>#005588</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>text-decoration</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>underline</FONT><FONT size=2>; }
</FONT><FONT color=#800000 size=2>A:active</FONT><FONT size=2> { </FONT><FONT color=#ff0000 size=2>font-family</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>Geneva,Verdana,sans-serif</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>color</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>#005588</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>text-decoration</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>underline</FONT><FONT size=2>; }
</FONT><FONT color=#800000 size=2>A:hover</FONT><FONT size=2> { </FONT><FONT color=#ff0000 size=2>font-family</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>Geneva,Verdana,sans-serif</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>color</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>#5C87B6</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>text-decoration</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>underline</FONT><FONT size=2>; }
</FONT><FONT color=#800000 size=2>P</FONT><FONT size=2> { </FONT><FONT color=#ff0000 size=2>font-family</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>Geneva,Verdana,sans-serif</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>font-size</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>11px</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>margin-top</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>0px</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>margin-bottom</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>12px</FONT><FONT size=2>; }
</FONT><FONT color=#800000 size=2>FONT</FONT><FONT size=2> { </FONT><FONT color=#ff0000 size=2>font-family</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>Geneva,Verdana,sans-serif</FONT><FONT size=2>; }
</FONT><FONT color=#800000 size=2>SPAN</FONT><FONT size=2> { </FONT><FONT color=#ff0000 size=2>font-family</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>Geneva,Verdana,sans-serif</FONT><FONT size=2>; }
</FONT><FONT color=#800000 size=2>TD</FONT><FONT size=2> { </FONT><FONT color=#ff0000 size=2>font-family</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>Geneva,Verdana,sans-serif</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>font-size</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>11px</FONT><FONT size=2>; }
</FONT><FONT color=#800000 size=2>UL</FONT><FONT size=2> { </FONT><FONT color=#ff0000 size=2>font-family</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>Geneva,Verdana,sans-serif</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>margin-top</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>6px</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>margin-bottom</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>12px</FONT><FONT size=2>; }
</FONT><FONT color=#800000 size=2>LI</FONT><FONT size=2> { </FONT><FONT color=#ff0000 size=2>font-family</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>Geneva,Verdana,sans-serif</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>margin-top</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>6px</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>margin-bottom</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>6px</FONT><FONT size=2>; }
</FONT><FONT color=#800000 size=2>SUP</FONT><FONT size=2> { </FONT><FONT color=#ff0000 size=2>font-family</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>Geneva,Verdana,sans-serif</FONT><FONT size=2>; </FONT><FONT color=#ff0000 size=2>font-size</FONT><FONT size=2>: </FONT><FONT color=#0000ff size=2>8px</FONT><FONT size=2>; }
</FONT></FONT><FONT style="BACKGROUND-COLOR: #efefef"></FONT>
Admin
Wow. Gotta love the 'redudancy' of some people. That reminds me of adding a inline frame inside a table which is inside another inline frame. I think I saw that somewhere. *shrug*
Nice job.
Admin
yes, the initial periods are missing from the class names, I re-created the stylesheety from memory in notepad and must have left them out when I typed it in (I promise I did NOT exaggerate). Don't get caught up in syntax for this example; it's not really the point.
(Despite the above note, I'm sure we can look forward to many "the real WTF is that it is missing the initial periods before the class names!" posts upcoming ...)
Admin
Exactly! Well-said as usual, Stan.
Admin
This comes close:
smallishBlueTahomaNormal, smallishBlueTahomaBold {
font-size:small;
color:blue;
font-weight:normal;
}
smallishBlueTahomaBold {
font-weight:bold;
}
Admin
Unless the initial dots got eaten by an SMTP engine
Admin
What is wrong with that? According to the recent specs, the user agent shouldn't define the formatting for it, but it does for backwards compatibility. He's just preparing for the event that a user agent doesn't give b a default formatting (I personally wish UAs quit giving a default large font size for tags like H1 so idiots would quit think it is for "making the text larger")
Admin
At least it isn't b.bold { font-weight: bold } with a usage like:
<b class="bold">
I suppose if you're printing to a high-end publishing press a b.bold, b.bolder, b.boldest (with font-weight: 400, 600, 800) might make sense.
Or not. We have pagemaker for a reason. :p
Awesome that the guy found a way to flatten an explicitly heigharchial cascading formatting language. I bet he's the kind of guy who makes the endless unrolled loops here, because 'loops are slow and generic code is slow'.
I was discussing with the CSS3 people (Mike Kay et al) on the mailing lists for a while on the feasilibility and best design for explicity CSS macros to make style reuse and interchangability easier, but I left it because 3 seemed to have lost steam. As far as I know it's still just floating and being turned into a variety of proprietary extensions in Opera and Mozilla.
Admin
Now that is comedy.
Admin
etc. Wouldn't it be wiser to do a
or even just a
and not to explicitly put the font name everywhere? After all, the idea of CSS is to cascade.
Admin
That's terrible. Should be:
const int ONE = 1;
const int TWO = 2;
const int ONEPLUSTWO = ONE + TWO;
Admin
Dang it, I wish I'd stay logged in.
Admin
The redundant font repetition is occasionally useful: Internet Exploiter isn't very good at cascading, so sometimes you need tricks like that.
ObWTF: as a CSS geek (did I list that in my long long list of programming languages yesterday? Never mind) I can state with authority, as someone who has been quoted by Zeldman and once sent a correction to Eric Meyer: today's post is very definitely a WTF, and the tragic sad-sack who wrote it should be slapped about with a copy of The Well-Meaning But Long-Winded And Irritatingly Preachy Orange Book until he recants.
Admin
Your first example wouldn't work as expected because of the . in front of body (unless you want it on all elements with class body). If the. is left out, it would work great, unless you added a size to it, it which case TDs in Internet Explorer would gladly ignore the size.
CSS is great, but would be even better if the results were more predictable in a lot of browsers.
Drak
Admin
'bold' is presumably a recursive abbreviation for 'BOld boLD'.
Admin
Wow he has written his style in stone. Good luck when the blue or green text have to be different colours and fonts later.
Admin
The default presentation given by browsers is important: it means that even in the absense of CSS a properly marked-up page is still readable. For semantic elements like h1 the default presentation could theoretically be anything, but in practice graphical browsers tend to mimic each other which makes people just assume that level 1 headings will be large and bold, but I used a browser a long time ago which also gave top-level headings a darker background so that they stood out as section or chapter markers.
When it comes to purely presentational elements like B, however, there's much less room for interpretation. The spec says that B means bold, so B means bold. It could be argued that a browser which doesn't render it in bold is violating the spec, but since it's deprecated it doesn't matter very much.
Admin
I allways use CSS like
.header
{
font-size:1.2em;
}
.white
{
color:white;
}
.red
{
color:red;
}
and if i want a red header :
<p class="red header">
or a white
<p class="white header">
Admin
And what does that get you other than save a (very) few keystrokes?
If you decide to go from red headings to white headings you still have to change EVERY SINGLE heading and EVERY SINGLE PAGE.
If you'd used CSS as it was intended, you'ld only have to make one change (to the CSS sheet). Further, you could even use two different style sheets, and have the same page appear two different ways (say for two different customers).
Check out CSS Zen Garden to see what you can do with Style Sheets.
Admin
Woah. I didn't know you could set two classes to an element? I tried it and it seems to work. Where in the standard does it say this is allowed?
Admin
http://www.w3.org/TR/html4/struct/global.html#h-7.5.2
Admin
"Multiple class names must be separated by white space characters."
Hmm, I never knew that [:$] And they say you don't learn anything by reading The Daily WTF [:D]
Admin
wow I never knew that as well.
But to the guy who said he uses class names like "Red" -- be careful, we may have a troll on our hands.
(Of course, I'm sure to the really smart people who read this forum it was brilliant sarcasm with subtle yet powerful irony and just the right amount of nuance, but to dumb guys like me it looked like someone who doesn't grasp the concept of what stylesheets are good for)
Admin
<p class="Warning header">
<p class="Normal header">
<p class="SideNote header">
Admin
No, not this time. There are lots of people who wouldn't even blink at doing something like that.
I found a CSS beginner's tutorial that tells you to have a class named "Red" -- http://codepunk.hardwar.org.uk/bcss05.htm
Admin
am i the only one to see how much time can this style sheet save?
obviously, all combinations of fonts and colors are contained in the CSS. when you then write HTML, you don't need to say crazy things like <font face="Comic Sans MS" size="16" color="PeachOrange"><b><i><u>hello</u></i></b></font>, you just simply declare it <span class="biggishPeachOrangeBoldItalicAndUnderlinedComicSansMS">hello</span> and are done with it!
truly, ingenious!
now if only could i remember in what order those "css parameters" go...
Admin
Now, using descriptive names for what a class does is pretty standard when working across countries. I've had to do it on quite a few projects where I've done the design and the coding was outside. Things like 'whiterow' and 'greenrow' for alternating colors. Yes, it's silly, but it seems like no one looks at the actual style sheet.
And using b as a class for bold is fine, and is certainly acceptable. And yes, it certainly can count down on page weight.
Admin
Admin
Mmm…tasty post!
I was saying that I think that the bigger problem is that he's using
<p>
for headers. There may be a tag for that…no, there are six!