July 1st, 7:41pm 0 comments

Nice input labels using jQuery and CSS

Nowadays it's very common to find websites "hiding" form labels in favor of input's default text. Even tough it's a cleaver idea, there is a better way to accomplish the same result without compromising accessibility.

First step is to create the form. I usually have all my forms inside a list:

UPDATE: It's necessary to turn off the "autocomplete" so the inputs don't get messed up.

Markup

Don't forget the "for" attribute, the script will rely on it. Go ahead and add the following CSS:

CSS

Read more …

Posted
February 7th, 7:56am 0 comments

CSS Tooltip

Here is how to create a very basic tooltip using only CSS. I've been using this technique all over my latest project.

Let's start by creating the following markup:

Markup

CSS

As I mentioned in a previous article, IE doesn't support RGBa. Adding the following styles, wrapped in a conditional comment, will make it work.

IE CSS

For more info about creating speech bubble using only CSS, go to DeSandro's tutorial on creating speech bubble.

Posted
December 16th, 5:24am 0 comments

Dev Notes #1 - Bookmarklet

I got tired of my colleague, *cough Buz, asking me for links and tools that I find and use while working, so I've decided to create posts where I list these things for future reference. Enough talk lets get to it.

Bookmarklet is a very important piece of my development. Lately, I've been using the following:

  1. ReCSS

    Super B tool, used to reload your css without refreshing the whole page. It's very useful if you want to change a website in production that you can't run locally.

  2. Firebug Lite

    Media_httponcemadecom_uatin

    If you develop websites in different browsers like I do (webkit nightly build), and can't live without Firebug; Firebug Lite is the way to go. It isn't as powerful as the Firebug add-on but it does a good job if you need to use the console or check for applied styles. Unfortunately, there is no way to change the css on the fly.

  3. Design

    Media_httponcemadecom_dgjej

    A very cool set of design tools. It includes grid, rule, unit and crosshair. A must have if you are designing in the browser.

  4. jQuerify

    As expected, it includes jQuery to the page. Very useful if you want to use firebug's console and jQuery selectors.

  5. Favelet Suite

    If you are a fan of the web developer toolbar add-on for Firefox, you will love this tool.

  6. xRay

    It displays CSS information of a selected object.

  7. Microformats

    Media_httponcemadecom_gicew

    Every time I markup a page, I try to use microformats as much as possible. This bookmarklet gives you a list of vCard on the page. Unfortunately, it doesn't display any other micro data.

If I missed any other bookmarklet, feel free to leave a comment with the link to it.

Posted
August 24th, 5:01am 0 comments

Adding hasJS Class When JavaScript Is Available

While at An Event Apart Boston, Jeremy Keith delivered the best lecture of the conference, about progressive enhancement. One slide caught my attention the most. It was about adding a class to the body if JavaScript was available. Here is his code example using jQuery:

Keith's Example using jQuery:

CSS

Why add a class if JavaScript is enabled?

Although the majority of desktop users have JavaScript enabled, mobile is one of the most used platforms to surf the web. Some mobile browsers don't support JavaScript. Keep in mind that search engines don't run JavaScript, so NEVER add important content using JavaScript.

Read more …

Posted
August 10th, 4:25am 0 comments

Renaming and Extending Easy-Clearing, AKA Clearfix

When positioniseverything.net posted an article about clearfix technique, it didn't take much for web developers and designers to start adopting it. Lately, Dan Cederholm has been talking about renaming the class clearfix to group, which semantically speaking makes a lot more sense. So, let's go ahead and rename the class.

New Easy-Clearing

Using conditional comments, let's add the proper code to handle IE 6 and IE 7 (IE8 supports the :after pseudo-elements; no extra code is necessary).

Read more …

Posted
April 27th, 3:29am 0 comments

Create Date Badge with Wordpress and CSS

This tutorial will walk you through creating date badges with Wordpress and CSS.

Media_httponcemadecom_xgoch

Let's start of by adding the necessary markup to render the appropriate date format. Create a DIV element with a class of "entryDate" and three children SPANs with respective classes "postMoth", "postDay", and "postYear".
Add the PHP code to get the post date from the database as shown bellow. For more PHP date format go to http://us.php.net/date

Markup

Now let's add styles to make it look pretty.

Read more …

Posted
December 14th, 6:19am 0 comments

CSS Tip: Drop Caps

Drop caps are usually used in desktop publishing, the first letter of a paragraph is enlarged to drop down 2 or more lines. Update: To make it work in IE6, the first letter needs to be wrapped in a span. IE6 Example

Markup

CSS

Browser Support

  • Firefox
  • Safari
  • Chrome
  • Opera
  • Internet Explore 7
Posted