Tag: internet-explorer

Jump to:

Article

What my recent redesign taught me about CSS

May 23 08

Repeat visitors (welcome back, both of you!) may notice a few things have been pushed about here on the site. I’ve been chipping away at this design for the better part of two months’ worth of spare time. So you’ll indulge me a bit of discussion. There’s just no way around it, boring as they may be, these sorts of posts are a necessary evil.

Less strict / Citation needed

I’ve decided to switch from XHTML to HTML 5. I was initially hesitant. HTML 5 felt like a cop-out. I’d spent all that time being strict, poring over validator messages. Was I willing to throw that time and effort away?

I guess I had never really understood why I was using XHTML vs. HTML. I suppose it was just because that’s what everyone else was using, and they probably knew better than me. Also, it was a badge of honor to know that my site validated against a stricter doctype.

I’ve lost track of the address, as it’s not on the WHATWG site as far as I can tell, but a little while back I read an article about why HTML 5 was being constructed. It made sense. The gist was that XHTML, particularly XHTML 2, was ill-suited to the purposes of many websites.

The real reason though, the real tipping point, was something incredibly small. One tag, actually. A tag most folks don’t even use regularly: <cite>. In contrast to the W3C, HTML 5 has a very clear definition for the use of <cite>. It’s for titles, and titles only. This is exactly what I wanted. The word “cite” might make sense for the source of quotes, but it’s a stylistic nightmare trying to determine which one gets italicized and which one doesn’t. So, that was it. I was going with the spec that had a better description of <cite>.

pre-cisely

Following the guidelines established in Richard Rutter’s A List Apart article on the subject I’ve set the font sizes in ems and done my best to maintain a steady vertical rhythm.1. Keeping the base font size as whatever the browser uses as a default — generally 16px — I calculated the desired size for text-containing elements such as <p>, <h1>, and the like. I tried not to set the font-size on any <div> containers. This kept me with a standard 16px em from which I could determine margins and paddings.

1 Within reasonable limits of my sanity. Certain elements just proved unwilling to concede at which point I ever so eloquently said “Fuck it! It’s good enough.” At least the text you read will be pleasantly configured.

Then I got to the <pre> element and things started acting funny. In one of my test cases I threw a bit of <code> inside a <pre> the way I would expect to do were I sharing some snippet. When I loaded this test in Firefox I was curious to see the text rendered quite a bit smaller than I had expected.

I didn’t set a font-family nor a font-size on the <pre> because I didn’t really see the need. It was just a box that honored line-breaks. I’d be filling it with <code> elements almost all of the time. I’d already set a font-family on those. Besides, if I changed the size that I wouldn’t be working from the standard 16px size and I’d have to refigure my margins and paddings. Using child selectors, I’ve set the size of <code> elements only if they are children of <pre> elements. It looks a bit like this:

pre code {
	font-size: 0.875em;  /* 16px x 0.875em = 14px */
}

Only, in Firefox, instead of 14px I was getting something in the neighborhood of 11px. After some consternation I realized that Firefox (and likely other browsers) sets up <pre> elements as fixed-width elements. By default, these have a font set at 13px. Sure enough, when I put plain ol’ text in there it came out at 13px.

I wanted a solution that didn’t involve setting a font-size on <pre> elements. After puttering about for a brief while, I came up with one.

pre {
	font-family: inherit;
}

This little line caused the <pre> block to pick up whatever is set by its parent, either a <div> or the <body>. Text inside won’t be fixed width by default nor will it be 13px unless told explicitly to be so.

Relatively speaking

One of my favorite additions to this version of the site is the sidenote, seen above. In fact, that note is one of the major driving forces behind the redesign. I’d just become interested in adding notes of some kind to my writing. I’m not entirely happy with the idea of footnotes in HTML. They work in print because a print page is designed with a specific page size in mind. But where to put them at the bottom of an ever changing landscape? On a page that might have any number of disparate posts?

So, this site uses sidenotes. They’re floated off to the left using negative margins. Negative margins feel pretty solid to me. I’ve had the heebie-jeebies about absolute positioning for years. Absolute positioning, I feel, is best left to scripting. Notes are styled like so2:

2 Oh lordy! It looks so crazy here in public. I swear these numbers seemed reasonable at the time.

.note {
	float: left;
	font-size: 0.75em;
	margin-left: -15.083em;
	text-align: right;
	text-indent: 0;
	width: 13.3333em;
}

Care to guess which major browser choked here?

notes on Internet Explorer 6 with and without position relative set

Figure 1 Internet Explorer 6 with position: relative (left) and without (right).

What you see above is a series of screenshots of a very early version of the site on Internet Explorer 6. The shot on the left is what the note is supposed to look like. The shot on the right is what I actually got using the code above. The text of the note just dropped off the face of the earth in IE 6. Increasing or decreasing the text size didn’t do anything. Nor did altering the size of the browser window. It was just gone. Except for the index.

The note indices are relatively positioned a little bit above the baseline. I’m not using <sup> tags because those are presentational and discouraged. When I saw that little one sitting there amongst a missing note it didn’t take long to figure out that relatively positioned elements showed up just fine. Everything else was swept away.

The solution, of course, was simply to add position: relative; to the note styles. Notes are now floated left, and positioned relatively to themselves. But since we haven’t added any actually positioning, they don’t move.

.note {
	float: left;
	position: relative;
	font-size: 0.75em;
	margin-left: -15.083em;
	text-align: right;
	text-indent: 0;
	width: 13.3333em;
}

In summation

So, that’s the obligatory redesign post. I reserve the right to continue to discuss CSS and HTML, but I’ll try my darnedest to find some kind of hook, as I tried to do here. Don’t worry, I’ll get back to the cross stitchery as soon as feasible.

Tags

Now that's just embarrassing, Microsoft. Even for you.

Jan 17 07

Normally I wouldn’t even be using Internet Explorer, particularly not the long dead Mac version of IE 5.2. The wife still has it installed on her iMac as she needs it for one of her professional organization sites (the sheer design idiocy of which often baffles the mind). I had launched it because I was hoping to sneak past the lame ass browser sniffer used by my employer’s equally lame ass employee self serve site to check for my W2.

(I didn’t make it, as it is specifically tailored to look for Internet Explorer 6.x and that alone. Using a Firefox user agent spoofer got me through the front gates but I still was unable to access anything but a cryptic error message.)

In the process of trying to get inside I was redirected to Microsoft.com to look for a nonexistent update to my IE browser. Microsoft’s website also uses yet another lame ass browser sniffer to serve up CSS. As it turns out, not even their own ancient browser made the list and what you get when you log in using IE 5.2 for Mac is a stylesheet-free pile of poop that looks like it might have been developed for Mosaic.

microsoft.com as viewed by MSIE5.2 Mac

Don’t happen to have the decaying corpse of IE 5.2 Mac cluttering up your hard drive? You can see a very similar effect if you try to join “The Social” over at zune.net using Camino. (Tip o’ the hat to Grotto 11’s Peeve Farm by way of Daring Fireball for that one.)

Tags

Curse you, buggy browsers!

Oct 10 04

Okay, when I said I wasn’t going to bother trying to fix things for the PC version of Internet Explorer I was being a bit shortsighted. I mean, was it realistic to think that I could ignore the most common browser in the world out of sheer spite? That’s just crazy talk.

(Besides, I’d like to be able to look at the site at work, just to assure myself that my creation was there. I’m stuck with IE 6.0 and a Windows box. Not much I can do about that, it’s work.)

It seems as though I’m suffering from the Peekaboo Bug. I’ve run into this before, and I don’t quite recall how I fixed it then. I’ve gone ahead and applied the Holly Hack to what I assume is the offending float. Did it work? I don’t really know yet. I’ll have to find a Windows machine to test it out.

It very well might not have. I seem to have a problem with my centered images too. See, what I did was give them the following style:

#content img
{
	display:  block;
	margin:  5px auto;
}

That display: block; seems to be causing some problems for IE. I’m not sure what, precisely. Seems fairly straightfoward (And yes, I know that IE 5.5 and earlier will not be centering the images. I can live with that.), but when I take it out the text in the middle doesn’t go anywhere, but the links on the right still come and go as they please. . .

Sigh. Sometimes it hardly seems worth it.

P.S.

So, the Holly Hack worked pretty darned well at clearing up the disappearing right hand side links, and possibly helped the content part stay where it’s supposed to be. That centered image, which does, in fact, seem to work in IE 6.0 still causes problems with the previous paragraph, and I’m sure the staff page is still ten kinds of messed up for IE users. Either I forget about centering images or I forget about IE. I can’t bring myself to use any more hacks to correctly center these things, they get pretty darned complicated, actually.

Tags

Re: the disappearing/reappearing text

Oct 07 04

Chances are if you’re looking at this site you’re using Internet Explorer. You don’t have to be ashamed. I used it myself for many years. There was a good long while when IE was the only game in town, or at least, beat the pants off of the antiquated competition.

But, times have changed. I mean, when is the last time Microsoft bothered to update IE? It’s been years since a significantly new version. There are still any number of very simple rules it just can’t seem to grok.

For instance, you may notice that there’s no text on the previous entry until you mouse over the title or scroll down at which point it magically appears as if sprung out of the aether. I guess it’s got something to do with the way I styled the images. There ain’t nothing wrong with it. Everything validates just peachy. It ain’t the markup or the stylesheet’s fault.

What I’m saying is this: I’m not going to run myself ragged making sure this is visible in every browser. Even if “every browser” happens to be codeword for “the most popular web browser on the planet.” I mean, if you care about your Internet it might be time to think about a change.

Tags