Div Class Clear – Without the Markup

The Div Class Clear is an old trick for getting container backgrounds to stretch down to the bottom of its contents. Although there has since been a push for the “float nearly everything” technique, I’m not convinced that constantly setting floats and widths across all elements is a sustainable method. Instead, let’s address the only problem people have with the Div Class Clear method – the added markup.

We can remove this markup quite simply with jQuery. Rather than mess with the actual on-page elements, why not insert it dynamically? Check out the code:

<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js?ver=1.3.2'></script>
<script type="text/javascript">
    $(document).ready(function(){
$("*:last-child").filter(function() {
return $(this).css('float') != 'none';
}).parent().append("<div class='clear'></div>");
    });
</script>
<style>
.clear {clear:both;}
</style>

Note: As you may imagine, this method assumes that the viewer has javascript enabled. Given that the downside is a matter of background stretching, and considering all the numerous other things that break when javascript isn’t enabled, I (generally) readily accept this sacrifice. After all, it’s not like Flash, where they get no content at all.

Common SEO Mistakes: CSS Image Replacement

Knowing about CSS Image Replacement and  Dynamic Text Replacement, as well as how to implement them, is undeniably valuable. As with most of SEO, having a developer’s skill set (or at least a knowledge of your options), will enable you with a can-do world view. In this case, when a client tells you that they’re committed to a web unsafe font for their headers, and that they therefore can’t use the appropriate keyword rich header tags, you’ll answer “yes you can”.

But there is a very common problem with over-zealous implementation of such SEO tactics without full consideration of their impact. Even SEOs who I have high regard for are victims of this vice. Have a look:

seomoz (Continue This Article…)