For a long time, I used something like <div style="clear:both"></div>
or its class equivalent to clear floated content in layouts. I knew, at some level, there were better solutions, but as these things go– I had deadlines to meet, had a working solution and there was never any inducement to look for a new one. Sure, there was a little extra markup, but it was so limited I could live with it.
Continue reading “Using overflow:auto to Clear Floated Content in CSS”
Yahoo! Posts an Interesting Illustration of the Lang Attribute.
In the post announcing that Yahoo! search results now has natural language support, the YDN blog offers up two audio samples that illustrate a screen reader reading mixed language text with and without the lang attribute. As you can plainly hear, the lang="fr"
attribute makes a great difference in the performance of the screen reader when handling mixed language text.
As they point out, the attribute also allows search engines to more easily parse stop words, so there’s an SEO benefit as well.
The lesson here? Polyglots unite! In using the lang attribute.
(Now I run off to add it myself to all the French,Italian, etc. phrases I’ve got littered around the site.)
Acid3 Test Released. I Took Some Screen Captures. Lots of Fail.
Screen Shots
These were done with browsercam, so the test may or may not have fully run its course by the time the 15 second delay was up. Still, it’s not like any of these browsers were close, so a few seconds isn’t going to save them if, in fact, they were cut off before the rendering was over.
As a note, I tried to do the Capture in Konqueror and it pretty much made Browsercam cry and/or vomit (“Do NOT Try The Capture Again!”) I’m going to log in shortly to see what the actual damage is.
[update]It’s a known bug and some commentors were gracious enough to take screen shots with updated versions.[/update]
Reference Rendering:
And now the Fail parade:
Continue reading “Acid3 Test Released. I Took Some Screen Captures. Lots of Fail.”
Two Columns of Variable But Equal Height Using Simple CSS and a Couple of DIVs
If, like me, you cut your web development teeth during while CSS was still in its infancy, you likely put together a lot of sites that featured two (or more) columns decorated with bgcolors or background images that flowed together in lockstep, always retaining equivalent height. It was pretty standard and basically came along free with tables for layout.
Then? Along came CSS, the separation of style and content (don’t forget behavior!) and the two columns living in perfect harmony became a casualty of the war against crufty code.
Which brings us to this post. I’ve played around with a similar technique before, but I’d never taken it to this, it’s logical conclusion. This technique grew out of some conversation at work. I don’t remember the specifics, but I remember I was looking at some unrelated piece of code on someone else’s monitor. Walking back to my desk it reminded me of one thing or another and then the pieces started to tumble around in my head. It was a couple of hours later, on my drive home from work, when they clicked into place and I thought, “hey, I could fake that old technique!”
The basic idea goes a little something like this: just because a background color or gradient appears to be part of an element, that doesn’t mean it needs to actually be applied directly to that HTML element. Instead, using some basic CSS and a repeating background image we can fake that two column look by positioning the two columns on top of the “columns” formed by the background image . As long as the containing DIV grows with either of the columns and the gap in the background image matches the background (or is transparent, wlloing the background to show through) the illusion is maintained.
It’s like magic.
Here’s the sample (which I only tested in FF2 and IE7):
Here’s the CSS:
/*the two-column container*/
#container #two-columns {
/*set that background image*/
/*repeat it and center it*/
background: url(images/bg.jpg) repeat-y center;
height: auto;
width: 500px;
margin:auto;
margin-bottom:20px;
}
#container #two-columns #column-2 {
/*float it*/
float:right;
height: auto;
width: 215px;
padding:5px;
}
#container #two-columns #column-1 {
height: auto;
width: 215px;
padding:5px;
}
/*clear the above float*/
#container .clr {
clear:both;
}
and here’s the HTML:
<div id="two-columns">
<div id="column-2"> A column in structural engineering is a vertical structural element that transmits, through compression, the weight of the structure above to other structural elements below. </div>
<div id="column-1"> A column in structural engineering is a vertical structural element that transmits, through compression, the weight of the structure above to other structural elements below. </div>
<div class="clr"></div>
</div>
I told you it was simple. If you’re familiar with modern layout techniques the above should be commonplace. The interesting bit (to me at least) is the concept of pulling the “background” of the two columns off of the columns themselves and onto the containing DIV. This separation can be a powerful technique. I’ve used it before in a different context, but I think this example really illustrates how useful it can be. I’m already starting to see other possibilities for this pattern.
Expanding the toolbox is fun.
Of course, before I can actually use this technique where it’s most needed by me, I have to come up with a scheme that works with both variable width and variable height. Tricky stuff. If I can pull that of, I’ll install it right on my home page. As it stands now I’m using JavaScript to equalize the heights on the two news DIVs at the bottom.
Boo.
The good news is I’ve actually made some progress with the variable width/height version. Unfortunately, nothing is quite ready for prime time though so that’ll have to be unveiled in another post. Keep your eyes peeled and your fingers crossed. I’ll keep at it with the typing.
YSlow Performance Grades for 200 Top Web Sites
What follows is a YSlow based performance survey of 200 top web sites. The list was seeded seeded by the the Compete Attention 200, a list based on the amount of time people spend at certain sites- as opposed to page views, etc. It’s a little out of date, but it’s as good a list as any to choose from, so I went with it (especially since sites like many of these where people spend a lot of time and that serve a lot of big media would benefit from far futures expires headers, CDNs, etc.)
For the most part I just dropped the URL in and went to the home page once, recording the YSlow score I saw there. With sites that had country specific home pages and "choose your country" gatekeeper screens, I clicked through to the US home page.
Sites marked with an asterisk were bought/merged, etc. and no longer pointed to the original Compete Attention 200 URL. Blank YSlow grades mean I couldn’t get the report to actually run. All three sites simply hung up when the performance button was pressed.
Other than that? Read it and weep:
Continue reading “YSlow Performance Grades for 200 Top Web Sites”