Archive for the ‘CSS’ Category

MODx Snippet, CSS and Yahoo Weather Feed

Tuesday, September 2nd, 2008

Weather FeedI recently created a MODx snippet using a technique described on CSS-Tricks. This little bit of PHP code calls in the Yahoo Weather RSS feed and allows you to generate output that can be styled using CSS and your own icons. You can modify the first line of the snippet below to output weather specific to your zip code.

I first created the snippet ‘Weather’ ( Here is the snippet code.), then simply placed the snippet call on the appropriate page: [!Weather?!]. I then used my CSS document to style the output and created containers that would display the appropriate class ( Here is my CSS document). I created a div tag that carried my icon as a background image. I figured if Yahoo generated a tag that was unaccounted for in my CSS then my scheme would continue to display the appropriate text while leaving the adjacent background image undisplayed (as opposed to the little red Xs if I had used an image tag). Since I am using transparent gifs, I figured no one would be the wiser should this occur. Gif’s were derived from Nordic Weather.

You can see it in action on the Batesville, Arkansas Area Chamber of Commerce website.

Control & the CSS Reset

Friday, April 25th, 2008

Browser Rendering and CSSI have been reading a couple of blog posts this morning which reflect two very polar stances on the use of a CSS reset document. A CSS reset document is utilized to strip away all margins and padding, incluging the default page form elements. Effectively leaving you with a blank, style sheet, slate.  Jonathon Snook’s article, “No CSS Reset“, explores why he believes the use of a CSS reset document is the antithesis of many of the concepts held near and dear by developers within the “Standards Community”. I have to say that I don’t completely disagree with him, particularly in the “Working with Nothing” argument he poses.

One of the principles I took away from the Web Standards community was the concept that pixel perfect precision across the various rendering engines was impractical and a remnant of the table-based layouts of yesteryear. With CSS and progressive enhancement, it was okay that things might look a little different from one browser to the next because of variations in what they supported.

Eric Meyer’s well written article, “Crafting Ourselves“, doesn’t directly advocate the practice, but rather defends it as a legitimate tool of the web design craft.

I’m not saying that craftsmen/craftswomen are those people who reject the use of common tools, of course. I’m saying that they use the tools that fit them best and modify (or create) tools to best fit them, applying their skills and knowledge of their craft to make those decisions. It’s much the same in the world of programming. You can’t identify a code craftsman by whether or not they use this framework or that language. You can identify them by how they decide which framework or language to use, or not use, in a given situation.

As I review both of these posts I find myself intrigued by the use of a CSS reset document. This is actually the first occasion that I have heard of it. I believe that the crux of Snook’s argument lies in the fact that the “Standards Community” had at one time assumed the position that, “the concept that pixel perfect precision across the various rendering engines was impractical and a remnant of the table-based layouts of yesteryear”. While I have, in the past, subscribed to this line of thought it was derived more from practicality than preference. Simply stated, it was more trouble than it was worth to try and control inconsistent cross-browser rendering too tightly.

Will I attempt to utilize a CSS reset document in the future? Absolutely. As I go through the site design process I frequently have the conversation with my clients about browser rendering inconsistencies and why they may see rendering disparities on their end. Eventually they acquiesce to this reality (what choice do they really have?). As I move forward I am hopeful that I may recapture this modicum of design control I once relinquished for the cause of standards compliance.

Eric Meyer’s Reset CSS

/* v1.0 | 20080212 */

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: ”;
content: none;
}

/* remember to define focus styles! */
:focus {
outline: 0;
}

/* remember to highlight inserts somehow! */
ins {
text-decoration: none;
}
del {
text-decoration: line-through;
}

/* tables still need ‘cellspacing=”0″‘ in the markup */
table {
border-collapse: collapse;
border-spacing: 0;
}

Pure CSS image popups

Monday, February 11th, 2008

I was tasked with creating two, small ”bookend” sites: Cullum Seeds and JWray Seeds. My graphic designer wanted the mouse over effect you see on the site navigation. In the past I have used either javascript or Flash solutions for mouseover effects in navigation, but really wanted to use a pure CSS solution. I thought I had seen a solution a while back on Eric Meyer’s site, and sure enough, here it is: the solution. It’s not exactly a cutting edge solution, but I thought it was worth sharing.

I have tested this in multiple Windows browsers, including: IE6, IE7, Firefox, and Opera. In Xandros browsers Firefox and Opera. In Apple browsers Firefox, Safari, and SeaMonkey. The only browser that seems to have trouble with this particular effect is the Windows IE6 browser. Despite the defect the site stills functions correctly, is lightly traveled and since IE6 use is on the decline I decided this was something that could be lived with, at least until I come across a better supported solution.