Friday, December 30, 2011

Inline-block in IE

display:inline-block;

This piece of code does not work in IE since inline-block is not recognized  in IE. To counter this we use an IE hack.

We should use:

display:inline;
zoom:1;

Also, suppose you have 2 inline-block elements inside one div. You will find that there is a gap of -4px between the elements which doesn't seem to go. This can be overcome by using:

.parentDiv{
  word-spacing:-4px
}
.childDiv{
  word-spacing:0px;
}

Image height not equal to td height

Consider that you have 2 columns in a row inside a table. One column(td) has texts and the other only has an image. Then, the height of the column and the height of the img will be different. You will always have a small gap below the image. This can be rectified by using :

img{display:block;}
This issue was caused because img is not considered as a block element.

Saturday, December 24, 2011

Undoing default browser styles

Use the given below style rules as the first line in your css files for undoing default browser styles.
Default browser styles may hinder with your style rules making it difficult for you to style the page.

html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,
pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,
s,samp,small,strike,strong,sub,sup,tt,var,dl,dt,dd,ol,ul,li,fieldset,form,
input,label,legend,table,caption,tbody,tfoot,thead,tr,th,td
{font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;
outline:0;vertical-align:baseline;margin:0;padding:0}
:focus{outline:0}
ol{list-style:decimal outside}
ul{list-style:none outside}
table{border-collapse:collapse;border-spacing:0;font-size:inherit}
caption,th{text-align:center;font-weight:bold}
fieldset,img{border:0}
a img,:link img,:visited img{border:none}
blockquote:before,blockquote:after,q:before,q:after{content:""}
address{font-style:normal}
pre,code,kbd,samp,tt{font-family:monospace;line-height:100%}
sup{vertical-align:text-top;font-size:50%}
sub{vertical-align:text-bottom}
:link,:visited,del,ins{text-decoration:none}
abbr{border-bottom:none}

Wednesday, November 16, 2011

Px to em calculator

Enter in px em
Enter in empx
Enter in pt  px
Enter in px pt

Points Pixels EmPercent
6pt 8px 0.5em 50%
7pt 9px 0.55em 55%
7.5pt 10px 0.625em 62.5%
8pt 11px 0.7em 70%
9pt 12px 0.75em 75%
10pt 13px 0.8em 80%
10.5pt 14px 0.875em 87.5%
11pt 15px 0.95em 95%
12pt 16px 1em 100%
13pt 17px 1.05em 105%
13.5pt 18px 1.125em 112.5%
14pt 19px 1.2em 120%
14.5pt 20px 1.25em 125%
15pt 21px 1.3em 130%
16pt 22px 1.4em 140%
17pt 23px 1.45em 145%
18pt 24px 1.5em 150%
20pt 26px 1.6em 160%
22pt 29px 1.8em 180%
24pt 32px 2em 200%
26pt 35px 2.2em 220%
27pt 36px 2.25em 225%
28pt 37px 2.3em 230%
29pt 38px 2.35em 235%
30pt 40px 2.45em 245%
32pt 42px 2.55em 255%
34pt 45px 2.75em 275%
36pt 48px 3em 300%