Ferdianjahja’s {CSSblog}

Gudang CSS cheat sheet {CSS cheat sheet round-up}

Posted by: Ferdian Jahja on: 11 October, 2008

The web is flooded with CSS cheat sheets that can greatly reduce your site development time. But when you don’t have the entire wall of your room to display them, I’ve sorted them according to their uses for your convenience.

Basic Cheat Sheets

Special Cheat Sheets

The list however is not exhaustive. As I spend more time with CSS, I will add more categories and links.

Fix PNG transparency in IE6

Posted by: Ferdian Jahja on: 11 October, 2008

Here’s the official link: http://www.webmonkey.com/codelibrary/Use_Transparent_PNGs_in_IE6

The problem

PNG images or icons appear with unwanted black shadows in IE6 browsers.

The fix

First of all, put the regular transparent PNG image in your HTML:

<div id="png-holder"><img src="/images/transparent.png" alt="" />

That will work perfectly in Firefox, Safari, and IE7. To make it work in IE6, add the following to your IE6 stylesheet:

#png-holder {
width: 300px;
height: 150px;
text-indent: -9999px;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader
(src='/images/transparent.png', sizingMethod='crop');
}

That filter rule is a proprietary Microsoft code that will force IE6 to render the alpha transparency in the PNG – but it does it by drawing another box on top of everything on the page and sticking the png in there, which leads to some odd behavior. Here’s the breakdown:

  • You must use the filter on a containing element for the PNG, not the image itself. For this reason, it’s easiest to wrap the image in a DIV or P tag.
  • You must declare a width and height for the container matching the width and height of the image.
  • You have to hide the original image – hence the text-indent: -9999px; rule. You can do the same thing to a transparent PNG that you’ve set as a background on a div by using background: none; instead.
  • You must use an absolute path to the image. As far as I can tell, this is just a restriction of the filter.
  • You can set sizingMethod to crop, which means if the image is larger than the dimensions of your container, the overflow will be hidden. Alternately, you can set it to scale, which will stretch the image to fit.
  • If you absolutely position the PNG over other content on your page, the user will not be able to click on any links under the image. That’s because the filter is drawing a new box on top of everything, completely overriding your z-index rules.

Features on T-Mobile G1, world’s first Google Android Phone

Posted by: Ferdian Jahja on: 5 October, 2008

Hey guys check this out:

{Gecko engine only} CSS3 imageless rounded corners

Posted by: Ferdian Jahja on: 27 September, 2008

Hey guys check this out: http://virtuelvis.com/archives/2004/11/imageless-rounded-corners

The official syntax is as follows:

border-radius: <length> <length>;

Here is an example:

This is an example.
The code i’m using is -moz-border-radius:10px;

Take note that this module is not supported by any browser, which means your borders will have squared borders even if you have declared the code above. Here’s what they say:

At the time of writing, the border-radius properties are not supported in any browser, since the CSS3 border module is still in “Working Draft” status.

However, browsers based on the Gecko rendering engine (Firefox, Mozilla) has experimental support for the border-radius property, and use the vendor-specific -moz- prefix for the properties, making it -moz-border-radius

Good news for Firefox 3 users!

Here’s the working draft at W3C

CSS Blog Review – www.456bereastreet.com

Posted by: Ferdian Jahja on: 27 September, 2008

For those of you budding CSS artists, I really think you should check out www.456bereastreet.com. This site is created and maintained by a Swedish web professional named Roger Johanssen. I put the bookmark of this site right below the w3schools, the official WWW consortium site.

This is what he says about the blog:

This site is a place for me to post articles, tutorials, and comments on subjects that are interesting and useful to me and hopefully to other web professionals, both developers and designers. Most articles on this site are related to web standards, accessibility, or usability in one way or another, with the occasional article on other subjects.

Indeed, he delivers the content well. The site contains much of the needed tutorials and discussions about web standards, accessibility or usability, with over 300 posts dedicated to CSS writing. I love Johanssen’s minimalistic approach for design and writing the code. There are few bells and whistles, and lots of the bread and butter needed by every CSS web professional.

Some of his posts that are really helpful to me:

If you have other great CSS blogs, please share them with me!

Centering an element with CSS

Posted by: Ferdian Jahja on: 25 September, 2008

Centering an element with CSS is not as hard as you might think. Basically you need to set the horizontal margin of the element to auto and the vertical margin to whatever it is that you want.

Here’s the code:

.DIVelement {margin:0 auto;}

Take note that I’m using the shorthand property for the margin property. You might want to check out Roger Johansson’s Efficient CSS with shorthand propertiesto learn about this technique.

You can apply this trick to everything from images, id elements to paragraphs. Some web designers who are addicted to centered layout pages uses this to position the main content area.

More on CSS centering :

My CSS writing style

Posted by: Ferdian Jahja on: 23 September, 2008

When it comes to writing CSS I think everybody has their own unique style of writing the code.

Mine will look like this: (this is taken from a fully-working website)

/* reset.css */
* {margin:0;padding:0;}
body {font:11px arial;line-height:1.5em;color:#333;}
a {color:inherit;text-decoration:none;}
a:hover {color:inherit;text-decoration:underline;}
a img {border:none;}
blockquote {font:italic 12px arial;color:#777;width:75%;margin:20px auto;}

As you can see, this is the modified YUI CSS reset. Gw sengaja menaruh selector, property dan value-nya di dalam satu baris spy lebih gampang dibaca. Dengan gini selectornya bisa quickly identified.

I’m using notepad++ for the editor. I think those programming students know this editor really well. But if you’re interested, just google it to download.

Sherley’s birthday dinner 14 Sept ‘08

Posted by: Ferdian Jahja on: 20 September, 2008

Sherley and Dr. Dolly

Another carevent! This time kita makan di Pizza King Grenvil. Tempatnya di depan Dapur Coklat. The food is good, especially yang fetucinni. The pizza is okay, for Rp 45,000 u’ll get a portion for 6. But Izzi Pizza is still better. 

Read the rest of this entry »

Tags:

  • None
  • Mark: Yes, this CSS3 code for rounded corners is brilliant - I've tested it & as you say it works perfectly in Firefox but unfortunately not in IE7 whic

{Word of the Day}

Pyrite
"The mineral pyrite, or iron pyrite, is an iron sulfide with the formula FeS2. This mineral's metallic luster and pale-to-normal, brass-yellow hue have earned it the nickname fool's gold due to its resemblance to gold."

Usage: "For me, the experience of finding that rare shoe was like finding actual gold nuggets in a collection of Pyrite."

{Blog Stats}

  • 436 people served