Showing posts with label CSS. Show all posts
Showing posts with label CSS. Show all posts

5/02/2011

CSS Hack for Google Chrome and Safari

If you are developing any site or designing any website, having design problem in chrome and safari you can write the below css, It only works on Google chrome and Safari Browser



@media screen and (-webkit-min-device-pixel-ratio:0)
{

.classname{ background:#ccc; } /*It will works on Google chrome and safari */

}

6/07/2010

How to Use Custom Font By CSS

Most of the programmer use Machine font like Verdana, Aria, Tahoma, Times New Roman, Georgia, Trebuchet MS etc...This is because Every Operating system have this font. But They never use other font Like "OCR A Extended" , "Tempus Sans ITC" etc. If anybody wants to use these fonts then they needs to paste this font into the Server, And by css they can use that font into their website.

First paste the font into your website with proper location/path. e.g :- I have paste "OCR A Extended.ttf" file into a font folder then I wrote my css like the example given below.


@font-face {
font-family: OCR;
src: url(../fonts/OCR A Extended.ttf); /* For IE */
src: url(../fonts/OCR A Extended.ttf) format("opentype");
/* For non-IE */
}



body{font-family:OCR;}





You can change URL/path according to your website . Now you can see the effect in every Operating System

3/26/2010

CSS Hacks for Internet Explorer 8

Like IE6 and IE7,IE8 also needs some hacks .Let the css is something like given below

.style1{ width:320px;}

If this css will not show perfect only in IE8 then we need to write

.style1{ width:320px;width:300px\9;}

Using ( \9 ) sign indicates that this css will render by only in IE8 Browser not any browser will understand it's meaning.

3/20/2010

CSS Hacks for Internet Explorer 7

Like IE6 ,IE7 also needs some hacks some times.For that we need to write the css something like given below

.style1{ padding:10px 0 0 20px;}

If this css will have any problems in IE7 then we need to write the css like

.style1{ padding:10px 0 0 20px; !padding:10px 0 0 18px;}

Using ( ! ) sign indicates that this css will render by both IE7 and IE6 not in other browser.

CSS Hacks for Internet Explorer 6

Css Hacks is the most important things for all the designer,if they want to show a page perfect in every browser. Basically all browser show perfect design,But all IE Browser have some problems to show the actual view for that it needs to give some css hacks

Css hacks For IE6

when we give the width of a block level element by css maybe that width increase in IE6 or when we give padding or margin of an Element Ie6 may show some more Padding or margin.That time it needs to write the _padding or _margin and decrease the padding or margin or width;By writing _width or _padding will effect only in IE6 browser not in other browser. For Example

.style1{ width:500px;}

If this width will not show in IE6 perfectly then we need to write this class like

.style1{ width:500px;_width:490px;}

Ie6 will render the 2nd width but all browser will render the first width