Archive for the ‘css’ Category

Cross Browser Compatibility Every Time

Monday, October 27th, 2008

1. Always use strict doctype and standards-compliant HTML/CSS.

2. Always use a reset at the start of your css.

3. Use -moz-opacity:0,99 on text elements to clean up rendering in Firefox, and text-shadow: #000 0 0 0 in Safari.

4. Never resize images in the CSS or HTML.

5. Check font rendering in every browser. Don’t use Lucida.

6. Size text as a % in the body, and as em’s throughout.

7. All layouts divs that are floated should include display:inline and overflow:hidden.

8. Containers should have overflow:auto and tigger has Layout via a width or height.

9. Don’t use any fancy CSS3 selectors.

10. Don’t use transparent PNG’s unless you have loaded the alpha.

thanks to anthony short

Great alistapart articles

Thursday, July 10th, 2008

 

Faux Absolute Positioning

Another advantage of the technique is that it mitigates much of the fragility of floats. When the content of a floated box is wider than the box itself, it pushes the next box to the right (and by consequence, the box often drops down). With faux absolute positioning, the box to the right stays in place, no matter what.

 

Sign Up Forms Must Die

When planning a customer’s initial experience for your web service, think about how you can avoid sign-up forms in favor of gradual engagement. Show potential customers how they can use your service and why they should care.

 

Beyond DOCTYPE: Web Standards, Forward Compatibility, and IE8

Two key factors, working in concert, have made the DOCTYPE unsustainable as a switch for standards mode.

 

How to Size Text in CSS

In this article, we will reconcile the designer’s requirement for accuracy with the user’s need to resize text on demand, arriving at a best practice that satisfies designers and users and works across browsers and platforms.

 

Multi-Column Layouts Climb Out of the Box

Create an elastic multi-column layout of equal height.

 

Automatic Magazine Layout

“Finding an attractive way of displaying any two, three, or four images together (regardless of shape and size) has always been difficult without manual resizing or cropping.”

 

It seemed my zeal for linkage had come into conflict with my desire to improve print usability.

 

High-Resolution Image Printing

Your client looks up and says, “Why does our logo look funny when we print the pages?” Do you sigh dramatically, or learn about Ross Howard’s technique for printing high-resolution images via CSS? We vote for option B.

 

Complex Dynamic Lists: Your Order Please

Help your site’s visitors reach their goals quickly with a dynamic menu that takes its cue from the Mac OS X Finder.

 

Hybrid CSS Dropdowns

Yup. It’s yet another CSS dropdown article — but one that resolves many problems associated with common dropdown methods and degrades beautifully. Hybrid CSS dropdowns allow access to all pages, keep the user aware of where she is within the site, and are clean and light to boot. It’s a tasty little vitamin pill, so quit sighing and try it.

 

Pocket-Sized Design: Taking Your Website to the Small Screen

Creating a handheld-friendly style sheet that works well even on handheld screens no wider than 120px.

 

Drop-Down Menus, Horizontal Style

Multi-tiered drop-down menus can be a hassle to build and maintain — especially when they rely on big, honking chunks of JavaScript. Nick Rigby presents a way to handle this common navigation element with a cleanly structured XHTML list, straightforward CSS, and only a few concessions to browser quirks

 

 

Thinking Outside the Grid

“There is a new kid on the block, and her name is ‘I’ve never designed with a table in my career.’”

 

Printing a Book with CSS: Boom!

“HTML is the dominant document format on the web and CSS is used to style most HTML pages. But, are they suitable for off-screen use? Can CSS be used for serious print jobs?”

 

CSS Swag: Multi-Column Lists

If you want to present a list in multiple columns you’ll need to compromise. Choose your poison…

 

Introducing the CSS3 Multi-Column Module

The module’s intent is to allow content to flow into multiple columns inside an element. It offers new CSS properties that let the designers specify in how many columns an element should be rendered. The browser takes care of formatting the text so that the columns are balanced.

 

It seemed my zeal for linkage had come into conflict with my desire to improve print usability.

 

 

High-Resolution Image Printing

Your client looks up and says, “Why does our logo look funny when we print the pages?” Do you sigh dramatically, or learn about Ross Howard’s technique for printing high-resolution images via CSS? We vote for option B.

 

 

Complex Dynamic Lists: Your Order Please

Help your site’s visitors reach their goals quickly with a dynamic menu that takes its cue from the Mac OS X Finder.

 

Spruced-Up Site Maps

The clean-n-simple site map gets a nice haircut and and a shoe-shine as Kim Siever shows us how to hook custom bullet styles to troublesome nested lists.

 

Hybrid CSS Dropdowns

Yup. It’s yet another CSS dropdown article — but one that resolves many problems associated with common dropdown methods and degrades beautifully. Hybrid CSS dropdowns allow access to all pages, keep the user aware of where she is within the site, and are clean and light to boot. It’s a tasty little vitamin pill, so quit sighing and try it.

 

Bulleted Lists: Multi-Layered Fudge

A passion for web standards can become a broken heart when effects that are easy to achieve with table layouts seem to defy the earnest CSS- and markup-conscious designer. Fortunately, new ALA author Nandini Doreswamy loves a challenge. Here she shows how to create two columns of bulleted lists in the flow of text.

 

The Way It’s Supposed to Work

Groundbreaking accessibility information. Project management and information architecture theory from old-school experts. Plug-and-play solutions to universal design and development problems. Experimental CSS/DOM hacks that use non-semantic elements to do funky design tricks. One of these things is not like the others…which is why we’re introducing a tiny new feature to the magazine.

 

Cross-Column Pull-Out Part Two: Custom Silhouettes

The cross-column pull-out gave us a new technique for marking up a layout with a pull-out positioned between columns. Now we examine a variation of the technique for wrapping around the edges of a non-rectangular image positioned between columns.

 

Big, Stark & Chunky

You’ve designed for the screen and made provision for blind, handheld, and PDA browser users. But what about low-vision people? Powered by CSS, “zoom” layouts convert wide, multicolumn web pages into low-vision-friendly, single column designs. Accessibility maven Joe Clark explores the rationale and methods behind zoom layouts. Board the zoom train now!

 

Cross-Column Pull-Outs

Print designers like to wrap text around images that sit between columns. Now you can, too. Daniel Frommelt takes us where no web layout has gone before.

 

Invasion of the Body Switchers

Wouldn’t it be great if we could update the classic ALA style switcher to accommodate multiple users and devices, including some that aren’t even traditional browsers, all from a single JavaScript and CSS file? Well, now we can! Enter the Body Switcher.

 

Pocket-Sized Design: Taking Your Website to the Small Screen

Creating a handheld-friendly style sheet that works well even on handheld screens no wider than 120px.

 

Drop-Down Menus, Horizontal Style

Multi-tiered drop-down menus can be a hassle to build and maintain — especially when they rely on big, honking chunks of JavaScript. Nick Rigby presents a way to handle this common navigation element with a cleanly structured XHTML list, straightforward CSS, and only a few concessions to browser quirks.

 

Creating Liquid Layouts with Negative Margins

Two- and three-column, liquid page designs with header and footer are easy to dash off using old-school HTML table layout methods. Designing them in CSS is trickier, and can sometimes even require you to structure your page’s content elements in a specific (and undesirable) order. Negative margins to the rescue! Ryan Brill whips up two quick CSS layouts to demonstrate the power of negative thinking.

 

Dynamically Conjuring Drop-Down Navigation

Got content? Got pages and pages of content? Wouldn’t it be nice if you could offer your readers a drop-down menu providing instant access to any page, without having to sit down and program the darned thing? By marrying a seemingly forgotten XHTML element to simple, drop-in JavaScript, Christian Heilmann shows how to do just that. There’s even a PHP backup for those whose browsers lack access to JavaScript. Turn on, tune in, drop-down.

 

Dynamic Text Replacement

Let your server do the walking! Whether you’re replacing one headline or a thousand, Stewart Rosenberger’s Dynamic Text Replacement automatically swaps XHTML text with an image of that text, consistently displayed in any font you own. The markup is clean, semantic, and accessible. No CSS hacks are required, and you needn’t open Photoshop or any other image editor. Read about it today; use it on personal and commercial web projects tomorrow.

Mountaintop Corners

Most of us have experience creating “rounded” corners by erasing pixels. It’s a rudimentary web design technique — or so we always thought. But in the hands of Dan Cederholm, author of Web Standards Solutions, this seemingly simple technique paves the way for boxes and borders that can change sizes and colors at your whim.

 

CSS and Email, Kissing in a Tree

Despite prevailing wisdom to the contrary, you can safely deploy HTML emails styled with good old-fashioned CSS. If you’re not content to roll over and use font tags in your HTML emails, read on.

 

CSS Design: Custom Underlines

While web designers generally have a great deal of control over how a document should be presented, basic CSS doesn’t provide many options for the style of underlines below the links on a page. But with a few nips and tucks, you can take back creative control of the way your links look. Frequent ALA contributor Stuart Robertson shows how.

Faux Absolute Positioning

Thursday, July 10th, 2008

from alistapart

There are two popular approaches to positioning with CSS: float and absolute positioning. Both approaches have their pros and cons. My teammates and I have developed a new positioning approach that gives us the best of both worlds. After quite a bit of experimenting and testing, it’s time to share the technique with the rest of the world and see how we can work together to improve it. I’m calling it “faux absolute positioning” after the faux columns technique that simulates the presence of a column.

Why do we need another CSS layout technique?

Many website designs are based on a columnar layout with a header and footer. With absolutely positioned layouts, it is almost impossible to position the footer if the columns can grow vertically. With floated layouts, unexpected content changes can cause entire columns to wrap (“float drop”), as described by Shaun Inman in Clearance. This is undesirable and hard to control in Internet Explorer because of IE’s problematic treatment of width.

(more…)

CSS Techniques

Thursday, July 10th, 2008

Triadic Background Setting with CSS
The Silverback web site uses three background images to create the illusion of 3D with simple CSS. No documentation is provided, however the source code is quite intuitive.

Creative Use of PNG Transparency in Web Design
With proper PNG support in Internet Explorer 7, and some handy JavaScript and CSS tricks to account for older browsers, we can use PNG images to greatly enhance our design vocabulary.

CSS Serve-Side Pre-Processor

Advanced CSS Menu

CSS SiteMap

Styling File Inputs with CSS and the DOM
File inputs (<input type=”file” />) are the bane of beautiful form design. No rendering engine provides the granular control over their presentation designers desire. This simple, three-part progressive enhancement provides the markup, CSS, and JavaScript to address the long-standing irritation

A Savvy Approach to Copyright Messaging
Derek Powazek suggests adding a copyright message to a photo and use CSS to crop its view. This is supposed to accomplish the goal of adding robust copyright information without defacing your own work.

Particletree Category List

Advanced CSS Menu Trick
What we want to do here, is instead of simply altering the state of the navigation item the user is currently rolling over, we want to alter the non navigation items as well.

CSS hover effect

A Stripe of List Style Inspiration
A different type of list and navbar styling. As stripes.

Dynamic CSS With Variables
Geoffrey Grosenbach describes how you can integrate CSS variables in CSS coding — with Ruby on Rails.•

Hyperlink Cues with Favicons
I wanted to extend the concept of hyperlink cues a little. For links that point to external sites, what if, instead of showing a generic ‘external link’ icon.

A CSS styled table version 2

CSS Step Menu
A method of designing the so-called step-menus, which have some steps users have to go through in order to achieve some aim. This menu offers a varying amount of steps, dependent upon the type of user accessing the application.

Creating bulletproof graphic link buttons with CSS
A CSS problem I have been wrestling with lately is how to create a bulletproof shrinkwrapping graphic button. By that I mean an image-based button that will expand and contract to fit the amount of text it contains. It is a very useful technique for CMS-driven sites that allow the client to change the text that is displayed on buttons, as well as for multilingual sites.

A successfull bulletproof image-based button should:

  • Automatically grow horizontally to fit any amount of text
  • Grow horizontally and vertically if text size is increased or if the text wraps to multiple lines
  • Retain its appearance within reasonable limits
  • Be able to have rounded (or other non-square) corners
  • Have no unclickable areas
  • Be readable when images are disabled

Scrollovers – A New Way of Linking
Everyone is familiar with hover-effects. This CSS+JavaScript-based techniques creates the Scrolleffect – not really necessary, but it’s nice to know, how it can be done.

•