Sierra Image Works web design Blog

Any font on the web @font-face

January 18th, 2010 | 

1. Conver fonts of any type to to .eot font format: www.fontsquirrel.com/fontface/generator

2. Insert the following script into css file:

@font-face { 
 font-family: 'Eaves';
src: url('/fonts/MrsEavesItalic.eot');
src: local('MrsEaves Italic'), local('MrsEavesItalic'), url('/fonts/MrsEavesItalic.otf') format('opentype');
}

How to center absolute positioned element

December 1st, 2009 | 

Naturally an element with absolute positioning tends to be align to the left. To make that element float in the center horizontally use the following code:

#elem {
position: absolute; left: 0; right:0;
}

Unfortunately this does not work in EI6-7

JavaScript – clear value of input field

November 6th, 2009 | 

This useful code sets the value on an input field to nothing.

<input type="text" value="anything" onclick='this.value = "";' />

Applying two background images

October 25th, 2009 | 

To apply two images to  HTML page background you can use the following code:

html {
 height: 100%;
 background:url(bg.gif);
}

body {
 margin:0;
 background:url(bg_content.gif) repeat-y center top;
 min-height:100% !important;
 height: 100%;
}

min-height:100% – allows the background image to stretch beyond the 100% window height if the page content is longer