Archive for the ‘CSS’ Category

Styling File Input Type In Forms

Saturday, May 10th, 2008

file input fields

Styling form elements is probably one of the toughest challenges in CSS design, right up there with positioning and dealing with varying browser quirks. That is why I personally try to avoid styling form elements, unless absolutely necessary.

Probably one of the toughest elements to style is the input type=”file”. It’s that cute little input box with a browse button beside it. You normally encounter them when uploading photos and files on a website.

In a perfect world these form elements should look consistent on all platforms and across different browsers. But this is not a perfect world, and so those who seek to style their form elements are faced with the task of making these form elements look consistent. A not to difficult task for standard input boxes, text areas, and buttons, but as always there needs to be a single element that just would not cooperate and obey CSS rules. You got it: input type=”file”

So we resort to using tricks such as multiple div layering, making the input box invisible, and even JavaScript (to the rescue, as always). For the longest time my favorite reference is Michael McGrady’s technique, which you can read about here.

Then there are those who decide that the best way to deal with these ugly creatures would be to hide the input box completely, leaving only the browse button visible for file selection. Accessibility proponents will probably cringe at this suggestion, but it works and sometimes that’s all that matters to the designer.

Personally, I prefer none of the above. In fact, I actually prefer not to style form elements at all (gasp!) Okay I was exaggerating. To not style form elements would be utterly moronic. But I think I got the point across. Remember the 90’s where everyone thought changing the color of the scroll bar was cool? Now it’s as good as dead and shamefully forgotten.

Personally the best form design is where styling done at a minimal, often restricted to sizing, placement, and font styling only. Let the operating system handle drawing of backgrounds and borders and scroll bars. They were designed that way. Plus, you’ll have less problems and and sleep better.

CSS Goes “D’oh!”

Friday, May 2nd, 2008

CSS Homer

This illustration of Homer Simpson was created using pure HTML and CSS. The source website is written in Spanish, and it doesn’t look like any explanation was given on the creative process. Looks like it took a lot of time to create though. Ingenious!

The resulting image displays properly across most modern browsers:

  • Internet Explorer 5.5, 6 y 7
  • Opera 9
  • Firefox 2
  • Safari 3

I have even tested it in Firefox 3 and it displays properly with no issues.

Here is the complete HTML code used to create CSS Homer:
(more…)

CSS Tricks Video: Introduction to Firebug

Monday, April 28th, 2008

Firebug is the definitive Swiss army knife of any web developer. This screen cast by CSS Tricks serves as an introduction to using Firebug. Check it out!

CSS Selecting Do’s and Dont’s

Friday, April 25th, 2008

CSS Globe has come up with a list of Do’s and Dont’s of CSS. This series’ part 1 covers the Do’s and Dont’s of CSS Selection, summed up as:

Summary

Do

  • When choosing use class names, use class names that describe content’s meaning or purpose, not it’s appearance.
  • Use few class names and use them on various elements.
  • Use type selectors to (re)set default styling. If you wish, use proper reset techniques (mentioned above).
  • Use multiple class names on single element to optimize your css.
  • Use combined selectors and precisely target your element

Don’t

  • Don’t use descriptive class names like "red", "blueDot" etc.
  • Don’t use complicated class names or id’s like "sideIntroSecondaryContentTop". Use descendant selectors instead.
  • Don’t use universal selector for resetting entire document.
  • Don’t use browser dependent selectors.
  • Don’t add unnecessary class names.

Check out the full article.

Save Development Time with XHTML and CSS Markup Generator

Monday, April 21st, 2008

XHTML CSS markup generator

Tired of writing boring XHTML and CSS code at the beginning of every slicing project? The XHTML / CSS Markup Generator is a web based tool that allows users to enter very intuitive, shortened syntax in order to generate corresponding XHTML and CSS markup, speeding up your work.

Sample input looks something like this:

#root
 #top
  #logo
   a[href="/"]=Markup Generator
  form#search
   fieldset
    label[for="query"]=Enter keyword:
    input[type="text" name="term"]#query
    button[type="submit"]=Find
 #header
  h1=Markup Generator
  h2=Nifty tool for XHTML/CSS coders
 #content
  #primary
   #about
  #secondary
   #contact.box
   #notify.box
   #bookmarks.box
 #footer
  p=Copyright (c) 2008 xMS.pl

This will result in the following XHTML and CSS code:

(XHTML):

<div id="root">
    <div id="top">
        <div id="logo">
            <a href="/">Markup Generator</a>
        </div>
        <form id="search" method="post" action="./">
            <fieldset>
                <label for="query">Enter keyword:</label>
                <input id="query" type="text" name="term" />
                <button type="submit">Find</button>
            </fieldset>
        </form>
    </div>
    <div id="header">
        <h1>Markup Generator</h1>
        <h2>Nifty tool for XHTML/CSS coders</h2>
    </div>
    <div id="content">
        <div id="primary">
            <div id="about"></div>
        </div>
        <div id="secondary">
            <div id="contact" class="box"></div>
            <div id="notify" class="box"></div>
            <div id="bookmarks" class="box"></div>
        </div>
    </div>
    <div id="footer">
        <p>Copyright (c) 2008 xMS.pl</p>
    </div>
</div>

(CSS):

#root {  }
 #top {  }
  #logo {  }
   #logo a {  }
  #search {  }
   #search fieldset {  }
    #search fieldset label {  }
    #query {  }
    #search fieldset button {  }
 #header {  }
  #header h1 {  }
  #header h2 {  }
 #content {  }
  #primary {  }
   #about {  }
  #secondary {  }
   #contact {  }
   #notify {  }
   #bookmarks {  }
 #footer {  }
  #footer p {  }

Learn CSS Positioning in Ten Steps

Thursday, April 17th, 2008

css positioning tutorial

Probably one of the toughest hills to climb for every CSS beginner is positioning, and this article introduces positioning in 10 very easy to understand slides, with an accompanying screen shot of each technique. Check it out at http://www.barelyfitz.com/screencast/html-training/css/positioning/

CSS Type Set: Online CSS Font Styling Application

Friday, April 4th, 2008
CSS Type Set screenshot

CSS Type Set is an online application created to assist beginner CSS developers with the task of font styling. It features an AJAX-powered interface that automagically updates the preview pane in real time. The resulting CSS syntax can then be copied and pasted into a CSS file. Give it a try!

Create Windows Vista-like Transparent Borders With GlassBox

Tuesday, April 1st, 2008

GlassBox screenshot

GlassBox is a JavaScript library that allows you to add Windows Vista-like transparent effects on your website. It runs on top of the the Prototype and Script.aculo.us library and comes complete with an API documentation and tons of examples. It is released under the MIT license.

Create Nice-looking CSS Menus Quickly With IzzyMenu

Friday, March 28th, 2008

IzzyMenu screenshot

IzzyMenu is a free web-based tool for creating snazzy looking CSS menus with minimal effort.

Check it out!

Internet Explorer 8 Beta Released, Fails To Excite

Monday, March 10th, 2008

Microsoft has finally made Internet Explorer 8 Beta publicly available for download, and all I can say is: WTF?

First of all, IE8 can only be installed in Windows Vista SP1, XP SP2, 2008 Server, and 2003 Server SP2. Which leads me to think that this is nothing more than a business ploy to get people to upgrade their *cough* legal *cough* Microsoft OS.

acid2.png

Next, what happened to passing the ACID2 test? After bragging about this milestone months ago, it is still failing for some. The exact reason is still unclear, but this inconsistency is disappointing nonetheless.

Third, what about SVG support? The web community has been stuck with raster formats LONG ENOUGH! How much longer must we wait until we arrive at a standardized vector format?

Finally, let’s look at IE8’s “new and exciting” features:

Activities

screenactivities.png

Activities are contextual services to quickly access a service from any webpage. Users typically copy and paste from one webpage to another.

Kind of cool, but plugins / extensions / add-ons in Firefox do the trick just fine.

WebSlices

screenwebslicepreview2.png

WebSlices is a new feature for websites to connect to their users by subscribing to content directly within a webpage. WebSlices behave just like feeds where clients can subscribe to get updates and notify the user of changes.

Again, sort of cool. I am all for microformats, but RSS feeds are already a standard across all modern browsers in different platforms including mobile, so I doubt web developers will want to develop widgets that will only work on IE8.

Every “feature” listed after Webslices is basically pointless or a replication of a Firefox, Safari, or Opera feature. It’s sort of like the marketing team had to try very hard to come up with something to sell IE8 with. Nothing “new” or “exciting” here.

Favorites Bar

screenfavoritesbar.png

In Internet Explorer 7, the Links bar provided users with one-click access to their favorite sites. The Links bar has undergone a complete makeover for Internet Explorer 8.

screenfavoritesbar2.png

So basically, the team spent countless hours designing a new favorites bar that looks just like every other favorites / bookmarks toolbar and added a new menu item that saves favorites directly into the bar and called it a new feature.

This feature, for one, has really left me speechless.

Next!

Automatic Crash Recovery

screencrashrecovery.png

Automatic Crash Recovery (ACR) is a feature of Windows®Internet Explorer® 8 that can help to prevent the loss of work and productivity in the unlikely event of the browser crashing or hanging. The ACR feature takes advantage of the Loosely-Coupled Internet Explorer feature to provide new crash recovery capabilities, such as tab recovery, which will minimize interruptions to users’ browsing sessions.

Finally IE8 gets a feature that has been in Firefox for AGES! I guess this is their way of admitting that their browser crashes all to often.

P.S. How long did the designers come up with such a cool name as “Automatic Crash Recovery”? If I were them I’d try to trademark that before someone else does.

Improved Phishing Filter

screensafetyfilter.png

Internet Explorer 7 introduced the Phishing Filter, a feature which helps warn users when they visit a Phishing site. Phishing sites spoof a trusted legitimate site, with the goal of stealing the user’s personal or financial information. For Internet Explorer 8, we are building on the success of the Phishing Filter with a more comprehensive feature called the “Safety Filter.”

I can’t believe this made it to the “New and Exciting Features” list. The marketing team is really on a roll.

Activities, WebSlices, Favorites Bar, Automatic Crash Recovery, and now Safety Filter? What’s next, the Super Cool Browsing History Manager? Seriously who comes up with these names?! While renaming Phishing Filter to Safety Filter would prevent Grandpa Joe from getting a migraine while trying to imagine why he must bring a filter the next time he goes fishing, I must say that this only leads to more confusion.

It would have been much more intuitive if the Phishing Filter were moved as an option below the Security Filter, because the Security Filter does so much more than prevent phishing attacks. For one, there’s the group policy option for blocking unsafe sites, and two … well that’s just about it.

That’s really just about everything that there is with the new IE8 Beta. If this is any indication of what the final product is going to look like, then I guess we are better off without it. As far as web developers are concerned, it’s just another browser to produce hacks for. Speaking of looks, it looks exactly the same as IE7. At least the Mozilla Firefox team made the effort to come up with a new look in Firefox 3.

On a serious note, hard core developers may wish to take a look at the IE8 Beta 1 Whitepapers, which as of today appears to be central to a single new feature: Better AJAX Development. Hooray. Yeah I know I said this was a serious note. But really guys, WTF?