Tuesday, July 28, 2009

1 pixel heigh div in IE 6

If you want to create a 1px horizontal line, some people may use a 1px height div with a color background to accomplish it instead of using
tag. For example,

div.details-sep-hr {
background-color:#CCCCCC;
border:0 solid black;
height:1px;
margin:0;
padding:0;
}


This works perfect with all modern browsers but not in IE6. IE may generate a line more than 1px height. To fix this, add overflow hidden to the class.

div.details-sep-hr {
background-color:#CCCCCC;
border:0 solid black;
height:1px;
margin:0;
padding:0;
overflow: hidden;
}

Thursday, July 09, 2009

Negotiation in Apache

In Apache HTTP web server (v2.2), If the browser requesting an image (http://www.yahoo.com/images/example.png) for example without extension, such that http://www.yahoo.com/images/example, the server can resolve the issue automatically by search all files under "images" directory that match example.*. The reason behind this is the feature of "Content Negotiation" in Apache Web Server, it seems like this is only the feature for v2.2 or above.

The effect of MultiViews is as follows: if the server receives a request for /some/dir/foo, if /some/dir has MultiViews enabled, and /some/dir/foo does not exist, then the server reads the directory looking for files named foo.*, and effectively fakes up a type map which names all those files, assigning them the same media types and content-encodings it would have if the client had asked for one of them by name. It then chooses the best match to the client's requirements.


For more information, go to: http://httpd.apache.org/docs/2.2/content-negotiation.html#negotiation