"Again Too"
This evening I was playing with the kids. I'd have them count to a
specified number and then when they reached that number I would grab
them around their chest and throw them up in the air a couple of times.
The kids were in a pretty giddy mood so it was good for plenty of
laughs. After Eliana's turn, she would ask for more by saying:
"Again too, Daddy, again too."
When Berkeley was her age, he would use similar wording by saying
"more again, more again."
Layering with CSS
Ok, so I don't do much web design any more. Hardly any really. If you
don't include what little design I did for this blog, I haven't designed
anything from scratch since the
old iServer
days. Since that time, support for
Cascading
Style Sheets (or CSS) has become much more robust. While working
on my current project
(redesigning my wife's website...
Berrett Psychological Services),
I decided to dabble a bit more with CSS-based design.
I'm by no means an expert at CSS,
but I did have some fun and learned a few new
things during my project. The most useful of which was learning how to
do layering with CSS using the "z-index" property. If you
look at any web page on Kristy's new site (other than the home page...
for example, see here,
here,
here,
here, and
here), you'll see a
little logo in the upper left corner of the page. This logo is actually
sitting in it's own layer, neatly isolated from everything else on the
page. The underlying content is presented in a simple table with some
left-justified padding so that it isn't obscured by the logo. Sweet.
:: Posted by rus on Fri, 24 Mar 2006 2:19 am
:: Filed under /tech
PNGs with Alpha Channel Transparency and MSIE
I've been hacking on the BPS web
site for the last few days (er, uh, technically, the last few years).
As part of the new design effort, I created several
PNG images that have
alpha channel transparency. Alpha channel transparency allows an image
to sit on top of any background (single-color or multi-colored) and
look like it fits in the place perfectly. It is an extremely useful and
versatile feature... and a necessity for what I'm doing with Dr. Kristy's
new web site.
During my web design phase I did all of my testing using
FireFox (of course!).
Everything was looking great until I popped up Kristy's new website
in an MSIE browser I keep around just for compatibility testing.
You guessed it (*smacks head*) MSIE doesn't appear to properly support
the alpha-channel transparency (at least the version of IE I'm using on
Windows XP, which appears to be up-to-date). MSIE will show the image,
but all of the pixels that have opacity values are rendered with a
light cyan hue. To see what I mean and if you are using a version of
MSIE that is flawed, nav
here... you'll
see the light cyan in the lower right of the image. Yuck.
So, I fished around on google and found a workaround for MSIE that
uses a style filter that only MSIE recognizes. Using a nice
JavaScript
browser sniffer I found, I was then able to
author some code so that the PNG images with alpha channel transparency
are displayed on MSIE through the style filter, and simply displayed
directly as the image source for all other browsers. Here is an example
of what I did:
<html>
<head>
<title>MSIE Workaround for PNGs with Alpha Channel Transparency</title>
<script language="Javascript" src="/browser_detect.js"></script>
<script language="Javascript">
<!--
function loadAlphaTransparencies() {
var logoImage = document.getElementById("logo");
logoImage.src = "/media/home_left.png";
}
-->
</script>
</head>
<body>
<img id="logo" border="0"
style="width: 250px; height: 450px;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/media/home_left.png',
sizingMethod='scale')"
width="250" height="450" src="/media/sp.gif">
<p>
<script language="JavaScript">
<!--
if (!is_ie) {
loadAlphaTransparencies();
}
-->
</script>
</body>
</html>
Works great.
(Update Sun Mar 26 15:55:44 PST 2006 // updated the code to wrap better)
:: Posted by rus on Fri, 24 Mar 2006 1:28 am
:: Filed under /tech
JavaScript Browser Detection
While I have been working on redesigning my wife's company web site,
Berrett Psychological Services, I
encountered a problem with browser support for PNG images that include
alpha channel transparency... specifically, older (but still widely
used) versions of
Microsoft's
Internet Explorer do not correctly render
such images. Because too many people have not yet switched to
Firefox (which renders the PNG
images just fine), I was forced to modify my perfectly valid design to
accommodate for the implementation flaw in MSIE. Blech.
The first step in making such an accommodation was to detect whether or
not the browser viewing the pages is MSIE. Fortunately, many
people have walked this path before I have and authored some very robust
browser detection code in JavaScript. Here is one such example:
If you view source on any page found on the
BPS site, you'll note that I am
importing my local copy of WebReference's browser sniffer from
here. It works
great! I'm glad I didn't have to re-invent the wheel.
:: Posted by rus on Fri, 24 Mar 2006 1:24 am
:: Filed under /tech
|