Clear Clear Clear your floats!

Anytime you use a float and the containing div of that float isn’t big enough to hold it, the floated element will overflow the containing div unless you clear it.

Example:
A blog page displaying 10 posts, some with floated images. Some posts are fine because they don’t have large, aligned images or have enough text to balance things out. But other posts with images aligned to the left or right and have little text and so seem to be running into the post below them. What is actually happening is that the post below is getting mis-aligned because it is not clearing the floated image.

You could just use a smaller image or add more text.

But what if:

You need to show a large image, a smaller one reduces the visual effect.
It isn’t your content, you can’t just add more to solve this issue.
You want the text in the post to show alongside the image rather than under it, you want to show information above the image above the fold.

What should you do? You should Clear your floats!

You could add
[html]<br class="clear"/> <!–or–> <div class="clear"></div> [/html]

Then add [css] .clear { clear: both } [/css] to the stylesheet. This would solve the problem but wouldn’t be semantically correct because [html]<div class="clear"></div>[/html]
is an *empty HTML element. It neither provides or formats any information. Also this must be added to each post manually and chances are your clients will not remember or care to have to do this.
Better to take care of the problem site-wide with CSS by adding [css] .containing-div { overflow:hidden } [/css] to the stylesheet. This rule should be applied to the innermost div that will be handling the overflow.
Example, if you have a document structure like this:

[html]<div id="content">
<div class="outer">
<div class="inner"><p><img src="/images/image.jpg" alt="" class="alignleft" width="650" height="820"/>My lovely, large image.</p>
</div> <!–closes #inner–>
</div> <!–closes #outer–>
<!–then the next post–>
<div class="outer">
<div class="inner"><p><img src="/images/image.jpg" alt="" class="alignleft" width="150" height="220"/>Text Text Text</p>
</div> <!–closes #inner–>
</div> <!–closes #outer–>
<!–then the next post–>
<div class="outer">
<div class="inner"><p><img src="/images/image.jpg" alt="" class="alignright" width="350" height="420"/>My lovely, medium image.</p>
</div> <!–closes #inner–>
</div> <!–closes #outer–>

</div><!–closes #content –>[/html]

Div.inner would need [css] div.inner { overflow:hidden;} [/css]
And div.outer would get [css] div.outer{clear:both;} [/css]

Then you and your clients can go nuts with class=”alignleft” without ruining the look of the page.

Using [html]<div class="clear"></div>[/html] a few times due to deadline pressure isn’t such a huge crime. I’ve done it. But it isn’t a good habit to get into.

Using *empty HTML elements to enforce styling is a slippery slope.
Ever seen this beauty?
[html]<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>[/html]
I have.
What about this gem?
[html]<div>
<p>content content content</p>
<br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br>
</div>
[/html]

Both do the job of adding more space where needed when the content fell short and the designer needed to find a way to fix that for their page to look the way they wanted it to…
It’s not the best way to do it but a lot of the time a designer can’t rely on content alone in text or images to provide the formatting they need.Still, it’s better to take care of this in the stylesheet rather than in the html document.

P.S. I have made all these mistakes and many more far more hideous!

IE6, the Ugly Truth

Gross!

I’m working on a new site and things look good from my end but the client keeps seeing this blue that shows up for her on the site. Blue? What blue? There is no blue at all being used. So I thought.

I finally 2 and 2 together and realised she must still be on IE6. I used transparent .pngs to make up the header design and because I have IE7 and FF I wasn’t able to see this blue. Why? Because every other browser in the world can handle transparent alphachannels or whatever it is…Just not old stinkface.

I finally just went ahead and downloaded IE6 and got to see the blue. A dirty dingey blue. It’s truly ugly. My banner image is made up of a transparent png as well and that above is what it looks like in IE6. Another fun thing about running IE6: in it, my left sidebar was dropping down under my content div. Oh yeah. Hire me and I will make your site look as ugly as mine…in IE6.

I fixed the wandering div but the script I used to fix the transparent .png problem for IE6 did nothing.
So it’s back to the drawingboard to make some non transparent images for the meantime.When I have some more time I will try to find a fix. Meaning after I take a shower and walk the dogs I will devote the rest of my day to finding this fix because there is no way I can live without my transparent lovelies.And there is no way I can live with that yucky blue.

And for everyone who has not yet upgraded to IE7, Please Do. You’ll do even better to download FireFox.

Good News For All Us Font Freaks

I grouse frequently and often about how limited the selection of “core” fonts is with which to use in web design. Some say there are 16. Some say there are only 3. 16 or 3 it’s bound to come up with a client that the font you’ve used is “too clinical”,”schoolkid-like”,”typewriter-ish”,”dull”,”really bad”,”bad, awful, not at all what I want”…etc. You bow your head in shame. After all, if you were any kind of good web designer you could make the font pretty,couldn’t you?

Actually… I have a ka-ba-ja-zillion fonts downloaded to my computer so yes I can use any freaking font I want and I will see it in the design. You will not. You will see a default list of fail safe, dull, old universal core fonts. If everyone downloaded 10 fonts a day for the rest of their lives there would still be a big fat chance that the font you are using isn’t going to be in their computer. ‘Cause of all the fonts there are in the world.

Give us web designers a little bitty break,puleese. The reason we stoop so low as Arial is because it is the number one font everyone is bound to have. We might get all crazy and try to use Century Gothic because maybe 65% of the internets have it loaded but the rest sees Arial and thinks it sucks.

sIFR to the rescue. And if you use WordPress,Alejandro U. Alvarez to the rescue.

You should take a look at this picture,
otherwise you may have trouble understanding what the name field means or what selector means.

Also you should know that his plugin uses sIFR version 2 so you cannot use Ian Purton’s online conversion tool.

Alejandro included a command script you can run in Flash to automatically get your fonts and make swfs but I found it easier to download my own copy of sIFR package version 2.0.2. I opened sifr.fla in Flash, selected my font and then exported the movie in mac flash version 8. I closed sifr.fla without saving the changes.

I uploaded the font.swf to the right folder in the custom fonts plugin folder and I edited the custom_font.php file as instructed. His instructions are on the plugin page,so scroll down to find them.

I tried to do it his way with command> run command script he provided but when I used the produced swf I got this output on my page titles “text made by sifr version 3” or something similar. This just meant I was using incompatible versions of either mac flash or sIFR! Yeah, as simple as that.

I am not as nifty as Ian Purton but if you need a font you can email me the .ttf or .ot font you would like converted to a .swf and I will make you one in Flash. It takes about a minute to do. i may even already have it.

I should tell you that I am using Baar Sophia but what you are probably seeing is Trebuchet MS or Helvectica. And if you haven’t got those fonts you’re probably seeing Times New Roman.

Or *censored* Arial.

mccormicky is Under Construction

I got tired of my Bella theme, so I started to get a new look together but had got to stop and run off to the city to see Sex and the City which left me no time to finish up. This explains why my site didn’t look so great all day.
At least now things are lining up the way they are supposed to. Some may find the white out look a little plain but for now I just wanted to clean out the Bella elements and get rid of the rounded corners–they were fun but it’s time for something new.
However I owe other folks a lot of work and can’t spend too much time on this right now.