Posts in the CSS Category

Formal Weirdness

Published 18 years, 1 month past

As I described and tweaked my version of reset styling, a fair number of people asked (with varying degrees of politeness) why I didn’t just use a universal selector instead of that big ugly grouped selector.  I said that I wanted to avoid styling form controls (inputs, textareas, and so on), and the only way to do that, given the state of selector support in today’s browsers, is to list all the elements I want to reset while leaving out those I don’t want to touch—like all the form controls.

This led to a fair number of questions as to why I’d bother avoiding form controls, and I said it was due to their “inherent weirdness”.  By this, I meant that form controls are impossible to describe with current CSS; and if they were treated the way CSS says they should be, we’d all hate the results.  Furthermore, the handling of form control styling is going to be a very unstable branch of our field for the foreseeable future.

Herein, I scratch the surface of this entire mess.  Fair warning up front: this is going to be a long one.  Also, as Bette Davis once proclaimed, buckle your seat belts: it’s going to be a bumpy ride.


Let’s start with a (seemingly) simple form element: a checkbox.  Here are two in Firefox, one checked and one unchecked.

All right, now here’s a question: what should happen if I assign these checkboxes padding: 10px;?  Take a moment and think through the details.

“That’s an easy one,” you may say.  “There’s 10 pixels of padding between the checkmark and the borders of the box.”  And maybe you’re right.  But let’s consider the same question for these checkboxes from Safari.

Notice how the checkmark hangs jauntily out of the box?  If we add padding, does the checkmark become contained within the box—in other words, does the checkmark stay the same size while the box visually expands—or does it stretch in size so that it’s still sticking out of the box?  You don’t even have to think about what to do with the drop shadow or the glassy beveled highlight effect; just worry about what to do with the checkmark.  Again, take a few moments to think through all the implications.

All right, you should have an answer by now.  Bully!  The sad truth is that no matter what you’ve decided, you’re wrong.  Okay, I admit that’s unnecessarily harsh:  more properly, you aren’t right.  You can’t be, because there are no defined answers to these questions.

Thus, if a browser lets you style a form element, it’s doing so blindly, from a specification-compliance point of view.  The people who wrote that browser code were guessing.  No doubt they were intelligent guesses, but they’re guesses all the same.

So why not just define the answers?  That turns out to be a good deal trickier than we might hope.  Take checkboxes (please!).  They’re replaced elements, right?  You have an input element that ends up placing a symbol, in much the same way an img element places an image file.  The symbol changes based on whether the checkbox has been checked or not, something like a JavaScript-driven image-swap.  The appearance of the checkbox isn’t defined in any way, so browsers are free to do whatever they want, as we saw above.

That means that the “interior” of this kind of input element—the checkbox (filled or not)—is a black box from a CSS point of view.  There’s nothing in the document structure or content that represents the actual checkmark, for example.  You can’t in good conscience define the checkmark as content and the checkbox as the element that surrounds it.  So should padding apply at all?  Maybe.

But if it does, and the checkbox is a replaced element, then defining a background color and padding for the checkbox would put the defined background color around the symbol—the whole symbol, checkmark and checkbox and all—instead of inside the checkbox.  That’s a completely reasonable conclusion given the assumption that the checkbox symbol is replaced.  It’s just completely unreasonable if you’re a visual type and you want that checkbox to be filled in with red, for the love of Bob!

So: is a checkbox a combination of an element box surrounding content, or a completely replaced element?  Which padding-and-background effect should take hold?

Just to muddy the waters a bit further, consider the following:

  • What happens to the checkmark when the input is italicized, either directly or by inheritance?  How about when it’s boldfaced?  (Assume the checkmark comes from a font family that has italic and boldfaced versions of the checkmark available.)  What, if anything, should happen to the checkbox under either condition?
  • If text-decoration: underline is applied to the checkbox, should the whole box be underlined, or just the checkmark?  Does your answer change when you consider the effects of padding?
  • Should vertical-align apply to the checkmark, or to the checkbox as a whole in relation to the line of text in which it sits?
  • What effect should line-height have on the checkbox and its contents?  For example, what should happen if you say input[type="checkbox"] {line-height: 3em;}?  Don’t forget that the most common way for an element to experience altered line height is by inheritance.
  • Should height and width be honored on a checkbox?  If so, should they apply to the whole box, or to the “content” (the checkmark)?  If the former, what should happen to the checkmark as a result–should it stay the same size and be aligned in some way, or should its size scale along with the checkbox?

In my experience, the most common answers to these questions tend to be contradictory—some implying a box-and-content model, others implying a replaced model.  I mean, just look at the poser buried in the middle of that last point.  What does width even mean when it comes to a form control?  Is it just the content, like with non-replaced elements; or is it the whole element box, borders and all, like in replaced elements?

As far as the latest draft of CSS 2.1 is concerned, all inputs (really, all form controls) are replaced, the same as images.  So no background inside the checkbox; no change due to italics or boldfacing or line heights; vertical-align shifting the box as a whole; and height and width applying to the entire box.

You might feel that’s acceptable, overall, but remember that I said CSS 2.1 regards all form controls as replaced.  So all that would be just as true for text inputs and textareas as it is for checkboxes.  That’s probably not acceptable to most people.  For example, that would mean that vertical-align: baseline would put a text input’s bottom edge on the baseline of the text that surrounds it, instead of aligning the text inside the input with the text around it.  Almost everyone prefers the second to the first, and most browsers conform to that preference, but that’s not what should happen.  In fact, when it comes to form controls, nearly all known browsers ignore the specification’s assertion that form controls are replaced elements.

And we haven’t even touched the hard cases, like select boxes.  Here’s one from Firefox in the “closed” and “open” states.

Let’s jump straight to the obvious puzzler: what should happen if you declare select {padding: 10px;}?  Here are three different possibilities for just the closed select.

Go ahead, pick your favorite.  Got it?  Now, should the same thing happen when the select is “open”, showing all the options?  For that matter, should the same thing happen given this select box from Safari?

It does no good to say that your choice would be just fine if Safari would only just go along with everyone else.  There is no pre-defined appearance for select boxes, or for any other form control.  In Safari’s case, it’s pulling these things right out of OS X and placing them in the document—the very definition of replaced-element behavior.  (And yet, browsers keep treating them as if they’re non-replaced.)  Explorer does the same thing, actually, and is the reason why form controls seemed to have infinite z-index in IE6 and earlier—they were drawn by the OS after everything else on the document had been laid out.  Firefox, on the other hand, draws its own form controls, which is why they’re more consistent across operating systems, but also don’t suffer from draw-order issues like Explorer did.  (It’s also part of the reason Firefox takes longer to launch on many systems; rather than making use of the OS for things like form controls, it has to carry its own around with it.)

We could get into a very long discussion about whether form elements should always reflect the operating system or not, which usually breaks down to HCI advocates on one side of the debate and designers on the other.  Let’s not, though (at least not here).  Let’s just assume that form controls should be styleable, because that brings us right back to the central dilemma: how, exactly?

After all, we can make the previous select box riddle even more interesting.  Suppose you declare this:

select {padding: 10px;}
option {padding: 10px;}

Now what?  After all, there’s an option element visible there in the select box from the moment it’s drawn—or is it?  Maybe that’s a special feature of a select element that copies content from an option element to display when no option elements are visible.  We don’t know.  But let’s assume that what we see there is an option element visible inside the select element.  It’ll be either the first one in the list, or the one with a proper selected attribute.  Hey, what about this rule set?

select {padding: 10px;}
option {padding: 10px; border-bottom: 1px solid gray;}
option[selected] {font-style: italic; background: yellow;}

Yee haw!  There are a ton of questions I could pose here, but I’ll go with one of the trickier ones: should the gray option bottom border be visible inside the select box when the select is “closed”, or should it only appear on option elements when the select is “open”?  Oh, and here’s another good one: does the padding on the select element apply to the drop-down menu made up of option elements, or no?

The beauty is that whichever answers are perfectly obvious to you, it’s perfectly obvious to someone else that your answers are completely wrong.  And vice versa.

And remember, these are some of the simpler cases.  When you start considering things like how to style radio buttons and file inputs, things get really hairy.  I mean, just look at the differences between Safari and Firefox.

Merely sticking to questions of padding and background colors is vexing enough.  Start throwing in text/font styling, borders, and even foreground colors; they quickly generate a cornucopia of complex control condundra.  The pain!

And don’t think the entire issue of styling form controls is going to get any easier; in fact, the Safari team is about to make it a good deal harder.  If you read their post “Text Fields“, you’ll see that Safari will soon make it possible to do all kinds of stuff to text inputs.  (If you’re downloading nightly builds of Safari, it already allows these.)  Of the nine example images, only two have any hope of being described using current CSS—and even those have to dodge questions like exactly how a text input should be baseline-aligned (as mentioned earlier).

So in order to style form controls in any sort of meaningful way, it will be necessary to invent a whole bunch of new properties and pseudo-classes (and most likely pseudo-elements) and describe how they behave and interact.  That’s much more easily said than done.  It’s taken more than five years to not finish CSS 2.1, and that’s just a reduced and clarified version of CSS 2.  Just imagine how much longer it could take to not finish inventing a whole new branch of CSS.

Not that anyone’s really working on it right now.  The closest we have is the Basic User Interface Module, which became a Candidate Recommendation on 11 May 2004 (yes, three years ago) and has not moved since.  There is no other form controls module.  There are things that could apply in a variety of other modules (like “The box model“, “Generated and replaced elements“, and “line“), but none of them are explicitly about form controls and so their relevance is at best debatable.

In that vacuum, browsers are acting to different degrees.  As we saw earlier, Safari is pushing forward in a major way.  Explorer allows some form control styling, but not much.  Firefox allows a little more—but not all that long ago, it ignored all attempts to style form controls.  Opera blocks attempts at form styling, the last I checked.

Because there are no agreed answers, and each browser is making its own guesses, there are inevitably going to be conflicts.  If one out of five browsers uses (for example) padding to set the separation between the content and borders of text inputs, then * {padding: 0;} is going to make them seriously scrunchy, while the other four will completely ignore it.  I might then declare input[type="text"] {padding: 2px;}, but what happens when one of the other four starts applying styles to form controls, but treats padding on text inputs differently, adding padding to the default form control layout because it treats the whole interior of the input, instead of just the text, as the content?


As veterans of meyerweb have already guessed, this is not a post with answers.  Like many of my longer entries, it poses only questions and (I hope) provokes thought.  What I hope it also does is explain my aversion to applying CSS to form controls, and thus why I constructed a great big grouped selector for my reset style sheet instead of using the universal selector.  I understand why so many people want to go the universal route: it’s a lot simpler to type and uses a lot fewer characters.  I’m usually one for saving characters, but this is one case where I think extra characters are more than worth the possible cost.


Reset Reloaded

Published 18 years, 2 months past

After a bit of time to bake and a few more suggestions from readers, I have what I’m willing to call the final version of my take on the topic of reset styles.  To wit:

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
	margin: 0;
	padding: 0;
	border: 0;
	outline: 0;
	font-weight: inherit;
	font-style: inherit;
	font-size: 100%;
	font-family: inherit;
	vertical-align: baseline;
}
/* remember to define focus styles! */
:focus {
	outline: 0;
}
body {
	line-height: 1;
	color: black;
	background: white;
}
ol, ul {
	list-style: none;
}
/* tables still need 'cellspacing="0"' in the markup */
table {
	border-collapse: separate;
	border-spacing: 0;
}
caption, th, td {
	text-align: left;
	font-weight: normal;
}
blockquote:before, blockquote:after,
q:before, q:after {
	content: "";
}
blockquote, q {
	quotes: "" "";
}

So what changed from the last iteration?

  1. I added background: transparent; to the first rule.  It’s probably not as necessary as some of the other bits here, but it seemed like a good thing to add.

  2. Added a :focus rule to try to suppress link outlining.  Why?  So that you remember to define your own.  You should make sure to define an outline, as it’s an important accessibility aid.  If you have a universal default, one that applies no matter what the project, then replace my rule with your own.

  3. There’s now a body rule that sets a baseline line-height that will be inherited by the rest of the document (and can be overridden easily), and sets a foreground and background color.  Originally, I avoided setting the colors, but decided it was better to put them in.  Of course, if you have preferred color defaults other than black on white, edit the declarations to suit your taste.

  4. The a img, :link img, :visited img rule has been dropped.  This is because the only browser family it really affects is Gecko line, and they all honor author styles as having precedent over user agent styles (as they should!).  So this is already covered by the first rule.

  5. Added a rule for caption, th, td to be left-aligned and normal-weight.

  6. Added a blockquote, q rule to suppress quotes by way of the quotes property.  This has the same intent as the previous rule, but approaches it along a different route.

I also asked for help in figuring out how to simulate inherit in IE/Win.  In the end, it seems to me like doing so isn’t really necessary for most people.  As I said before:

[The inherit] effects, as seen in my development environment, will still serve the purpose of reminding me to build up the styles I actually want, and not use the browsers’ defaults as a crutch. There is the possibility of my forgetting that (for example) IE/Win italicizes em when I don’t want it to, but that’s something I’ll catch during the browser testing phase.

So that works for me, and I think for most people who have outlooks similar to mine.  But maybe you develop primarily in IE/Win, or you really want to have IE/Win handle as many of these resets as humanly possible.  In that case, you have two basic choices.

  1. Use the script and syntax contributed by Jonathan Snook and Dean Edwards.  Note, however, that Dean himself doesn’t recommend doing this, feeling that it’s too computationally expensive for such a small effect.  Dean has a lot of experience with scripting around IE/Win’s limitations, so I give his views on this a lot of weight.  On the other hand, I’d like to see IE/Win be able to honor inherit, or at least get the same behavior, so I might still use the script.  (Though I’d be even happier with a script that just tacked itself onto instance of inherit in a style sheet, like Dean’s IE7 script does for other CSS stuff.)

  2. Put in your own expressions, along the lines suggested by Priit and thacker.  It’s not quite the same thing, but it’s a pretty decent approximation.

Like I say, these aren’t necessary unless you’re really sold on the idea of IE/Win being forced into line with everyone else and don’t mind paying the computational overhead.  If so, then you can extend your own reset styles as needed.

That’s much of the point here: that this is not a case of “everyone must use these styles in a certain way without alteration”.  Nor am I saying that everyone must use them or else be cast into darkness.  Remember before that I termed these “my take on the topic of reset styles” (emphasis added).  Your take may be subtly or greatly different.  Think of these as a starting point for creating your own defaults, in addition to being a way to illuminate the nature of browser defaults.  Simply the act of taking those defaults into consideration and thinking about them closely puts you ahead of 99% of your peers.  I do think that reset styles are quite useful; otherwise, I wouldn’t have written about them here, and certainly not to the extent that I have.  My hope is that people will use them as a launch pad for their own resets and for deeper thinking about styling and browsers.

My thanks to everyone who commented, not just those I linked above.  And yes, I’m going to get to that “weirdness of form elements” post in the near future.

Addendum 2 May 07: I edited the CSS to change background: transparent to background-image: transparent, as it was supposed to be from the outset but I somehow didn’t see in any of the three times I looked over the declarations.  So I guess that makes this post now “final.0.1”.

Addendum 4 May 07: background-image: transparent?  There’s a big ol’ WTF.  Apparently my cold medication has warped me a lot more than I believed.  I’ve taken out that whole declaration and will not be editing the styles any further until I’m off the meds.  So, not quite final, apparently.


Inherit Expression for IE?

Published 18 years, 2 months past

The reset styles are currently held up on a point of non-support in IE/Win.  However, there’s a decent chance we can work around it.  I’m hoping you (or someone you know) can help.

One of the things I indicated was problematic, but that I would keep, was the use of inherit for a few properties.  This value isn’t supported by IE/Win, and while I’m okay with including it anyway, it could cause confusion for others trying to use my reset styles.

Priit Pirita suggested the use of IE expressions to simulate inheritance.  For example:

 font-style: expression(
   this.parentNode.currentStyle ? 
   this.parentNode.currentStyle.fontStyle : 
   ‘normal’);

That would assign the weight of the parent element for any element whose parent had a currentStyle, and fall back to normal in any case where that wasn’t true.

Cool enough, assuming you’re okay with using expressions, but there are a couple of wrinkles I haven’t quite worked out.  The first is this:

 font-family: expression(
   this.parentNode.currentStyle ? 
   this.parentNode.currentStyle.fontFamily :
   ‘[...???...]’);

What should be filled in for the [...???...]?  The font family that IE/Win uses by default when first installed?  A null value?  Something else?  I dunno.  Hopefully someone here does.

The second problem is that some people have reported errors generated by expressions; see this comment by thacker for an example.  Can anyone explain why those errors happen and how to avoid them?

The end goal here is not only to come up with inherit equivalents for font-weight, font-style, and font-family, but also to come up with a generic method of simulating inherit for any property.  Doing so would be an enormous boon to developers, so here’s hoping we can pull together and solve this puzzle.  Thanks!


Reset Reasoning

Published 18 years, 2 months past

The reset styles are undergoing yet another overhaul, but in the meantime, I thought I’d answer a question several people have asked: why?!?  Why do this at all?

The basic reason is that all browsers have presentation defaults, but no browsers have the same defaults.  (Okay, no two browser families—most Gecko-based browsers do have the same defaults.)  For example, some browsers indent unordered and ordered lists with left margins, whereas others use left padding.  In past years, we tackled these inconsistencies on a case-by-case basis; for example, making sure to always set both left padding and left margin on lists.

But there are all kinds of inconsistencies, some more subtle than others.  Headings have slightly different top and bottom margins, indentation distances are different, and so on.  Even something as basic as the default line height varies from one browser to another—which can have profound effects on element heights, vertical alignments, and overall feel.

This is not something we consider very often.  We think of our CSS as modifying the default look of a document—but with a “reset” style sheet, we can make that default look more consistent across browsers, and thus spend less time fighting with browser defaults.  Rather than say “the size of that heading is just right”, forgetting that not all browsers size headings the same way, I have to write the CSS that sets the heading to be the size I want (or the design requires, which comes to the same thing).

This is why so many people zero out their padding and margins on everything by way of the universal selector.  That’s a good start, but it does unfortunately mean that all elements will have their padding and margin zeroed, including form elements like textareas and text inputs.  In some browsers, these styles will be ignored.  In others, there will be no apparent effect.  Still others might have the look of their inputs altered.  Unfortunately, there’s just no way to know, and it’s an area where things are likely to change quite a bit over the next few years.

So that’s why I don’t want to use the universal selector, but instead explicitly list out elements to be reset.  In this way, I don’t have to worry about munging form elements.  (I really should write about the weirdnesses inherent in form elements, but that’s for another day.)

There’s another reason I want to reset a whole lot of styles on a whole lot of elements.  Not only do I want to strip off the padding and margins, but I also want all elements to have a consistent font size, weight, style, and family.  Yes, I want to remove the boldfacing from headings and strong elements; I want to un-italicize em and cite elements.

I want all this because I don’t want to take style effects for granted.  This serves two purposes.  First, it makes me think just that little bit harder about the semantics of my document.  With the reset in place, I don’t pick strong because the design calls for boldfacing.  Instead, I pick the right element—whether it’s strong or em or b or h3 or whatever—and then style it as needed.

The maddening barrier to this is, yes, Internet Explorer.  See, in order to set all elements to have the same font weight and style (both normal) and have all elements use the same font face without breaking inheritance, I need to declare the following:

font-weight: inherit;
font-style:  inherit;
font-family: inherit;

But IE/Win doesn’t support inherit, which would seem to bring that whole effort to a screeching halt.  I can’t explicitly assign the values, like I did in a previous version of the style sheet, because that would block the effects of inheritance.  Say, for example, I wrote this instead:

font-weight: normal;
font-style:  normal;
font-family: serif;

Okay, now I have this rule later on in the CSS:

h1 {font: bold 2em Verdana, sans-serif;}

Then I have this markup:

<h1>Considering a <em>Truly</em> Annoying Omission</h1>

The em in the middle of the h1 will be un-boldfaced, and in a serif face.  With the inherit values, it would be bold and in Verdana (or some sans-serif font).  I should have realized that from the outset, but sometimes my enthusiasm gets ahead of my reason.

So do I drop those inherit declarations?  In the end, no.  They won’t work in IE/Win, but since I develop primarily in Firefox and Safari, that’s not actually a problem.  Their effects, as seen in my development environment, will still serve the purpose of reminding me to build up the styles I actually want, and not use the browsers’ defaults as a crutch.  There is the possibility of my forgetting that (for example) IE/Win italicizes em when I don’t want it to, but that’s something I’ll catch during the browser testing phase.

Hopefully this helps clarify my motivations and thinking.  I’ll follow up with a new (and hopefully final) version of the reset styles in another post, along with commentary on what other things I changed.


Reworked Reset

Published 18 years, 2 months past

Here’s the latest version of my “baseline” style sheet, with some changes based on feedback from readers on the original post.

/* Don't forget to set a foreground and background color 
   on the 'html' or 'body' element! */
html, body, div, span,
applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dd, dl, dt, li, ol, ul,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
	margin: 0;
	padding: 0;
	border: 0;
	font-weight: inherit;
	font-style: inherit;
	font-size: 100%;
	line-height: 1;
	font-family: inherit;
	text-align: left;
	vertical-align: baseline;
}
a img, :link img, :visited img {
	border: 0;
}
table {
	border-collapse: collapse;
	border-spacing: 0;
}
ol, ul {
	list-style: none;
}
q:before, q:after,
blockquote:before, blockquote:after {
	content: "";
}

The changes are:

  1. The leading comment — rather than fill in some default document colors, which I hesitate to do given how often they’ll be changed, I just threw in a comment reminding the author that setting them is a good idea.  I’d expect that anyone who uses their own set of baseline styles will fill in their own favorite color set.

  2. font-weight: inherit; — this used to be normal, but it was pointed out that this would upset normal inheritance.  For example, if you set a div to be boldfaced, none of its descendant elements would inherit that boldness (because they’d be explicitly assigned normal).  Using inherit avoids this problem while still “zeroing out” boldface styling.

  3. font-style: inherit — same reasoning.

  4. vertical-align: baseline — this brings everything onto the baseline, including superscripts and subscripts.  This forces authors to determine the exact vertical offset they want for such elements, as well as any others they might care to vertically shift, as well as how they’ll accomplish said shift(s).

  5. a img, :link img, :visited img — this will make sure images in anchors and links don’t have a border by default.  Using a img covers images in named anchors, while the rest of the selector handles images inside either visited or unvisited links.  You might consider a img to be sufficient, and for now you’d be right.  But in the future, any element may be a link, not just a elements, so this gives us a bit of future-proofing.

I also put some spaces into the selectors to make them easier for me to read.  If you use these styles, you might consider stripping out the unnecessary whitespace to compact the rules as much as possible.

It was suggested that min-width: 0; be added to the first rule in order to invoke hasLayout, but Ingo Chao explained why that was a bad idea.  It was also suggested that text decorations should be removed from links, but I’d rather not.  I try never to mess with link decorations, and also figure that anyone who feels otherwise can add their own text-decoration declarations.

So we’ll see how well this one stands up to use in the wild.  Let me know!


Reset Styles

Published 18 years, 2 months past

At AEA Boston, I advocated using a “reset” or “baseline” set of styles, but not one based on the universal selector.  Instead, I said the styles should list all the actual elements to be reset and exactly how they should be reset.  During the Q&A afterward, an audience member asked me if I would create such a style sheet to share with the world, and I said that I would.

Then, during the break, someone else (sorry I’ve forgotten who!) reminded me that the Yahoo! UI group already did it with reset.css so I don’t have to.  Awesome!

…except that I don’t think it goes far enough in some areas, and a little too far in others.  So here’s my version of reset.css, based off of the YUI styles.

html,body,div,span,
applet,object,iframe,
h1,h2,h3,h4,h5,h6,p,blockquote,pre,
a,abbr,acronym,address,big,cite,code,
del,dfn,em,font,img,ins,kbd,q,s,samp,
small,strike,strong,sub,sup,tt,var,
dd,dl,dt,li,ol,ul,
fieldset,form,label,legend,
table,caption,tbody,tfoot,thead,tr,th,td {
	margin: 0;
	padding: 0;
	border: 0;
	font-weight: normal;
	font-style: normal;
	font-size: 100%;
	line-height: 1;
	font-family: inherit;
	text-align: left;
}
table {
	border-collapse: collapse;
	border-spacing: 0;
}
ol,ul {
	list-style: none;
}
q:before,q:after,
blockquote:before,blockquote:after {
	content: "";
}

I omitted elements like hr and the various frame-related elements, as well as form elements like input and select, because of their general weirdness, though I may change my mind about those at a later date.  I intentionally left out dir and menu because of their deprecated status.

I’m absolutely open to questions, comments, and suggestions, so feel free to use the comments for that purpose.

(Side note: if anyone’s disturbed by the unitless value for line-height, please read my post “Unitless line-heights“.)

Addendum: There have been some good suggestions in the comments, so they’re definitely worth reading.  See also the followup post, which incorporates some of those suggestions.


Stylish Spam

Published 18 years, 3 months past

From my comment queue, possibly the first time I feel a spammer is really speaking to me as a person:

Did u ever heard about CSS…? it will help your site.

Do tell, oh random anonymous stranger whose site URL crudely references the genitalia of older females!  I wish to learn.


Events in CSS and Web Design History

Published 18 years, 4 months past
Here’s a fun Friday question for everyone: what do you consider to be some of the most important events in the history of CSS and web design?  How about some of the most overlooked events in that same history?  (And yes, an event can be both.)  I’m not looking for the “best” answers—I want to know what you regard as important, overlooked, or otherwise worthy of mention.  So tell!

Browse the Archive

Earlier Entries

Later Entries