»
S
I
D
E
B
A
R
«
Minimum and Maximum Value of z-index
Jan 27th, 2010 by admin

The minimum value of z-index is 0, for Firefox, you can go all the way to -2147483647, but IE can’t read any value below 0.

The maximum value of z-index is 2147483647.

Checkbox vertical alignment in HTML CSS
Jan 19th, 2010 by admin

To vertically align checkbox in HTML CSS, one has to use a combination of vertical align and margin for the checkbox.

<style>.checkbox { vertical-align:middle; margin:0px; }</style>
<input type="checkbox" class="checkbox" />
CSS cellpadding cellspacing
Jan 18th, 2010 by admin

You can set HTML table cellpadding and cellspacing in CSS.

For example, if you want table cellpadding and cellspacing to be zero, here is how you can do it:

table {
    border-collapse: collapse; // 'cellspacing' equivalent
}
table td, table th {
    padding: 0; // 'cellpadding' equivalent
}
Showing Horizontal Scrollbars Only in CSS
Jan 8th, 2010 by admin

By right, you shouldn’t get both horizontal and vertical scrollbars unless you make the content large enough to require them.

Howeve typically due to a bug in IE, this happens at times.

IE6-7 (amongst other browsers) supports the proposed CSS3 extension to set scrollbars independently, which you could use to suppress the vertical scrollbar:

overflow: auto;
overflow-y: hidden;

You may also need to add the following for IE8:

-ms-overflow-y: hidden;
Using CSS in Django
Jan 8th, 2010 by admin

Here is the official document that explains how to use CSS in Django: http://docs.djangoproject.com/en/dev/howto/static-files/, basically it’s about setting up your URL’s, then reference you media files in the template.

Add CSS class with JavaScript
Jan 3rd, 2010 by admin

To add instead of replacing CSS class with JavaScript is easy.

Here is how you can add a CSS class:

document.getElementById("MyElement").className += " MyClass";
Applying CSS to iFrame
Jan 2nd, 2010 by admin

By default, iFrame content doesn’t respond to the CSS on the parent HTML. To apply parent HTML CSS rules to the iFrame, you need the help of JavaScript.

Here is the snippet to do so:

var frm = frames['frame'].document;
var otherhead = frm.getElementsByTagName("head")[0];
var link = frm.createElement("link");
link.setAttribute("rel", "stylesheet");
link.setAttribute("type", "text/css");
link.setAttribute("href", "style.css");
otherhead.appendChild(link);
IE8 overflow auto and max-height
Jan 2nd, 2010 by admin

In IE8, if you set max-height value and overflow to auto, it behaves as if overflow is hidden. The scrollbar won’t appear.

There is a really nasty fix for it.

For instance, if you want to set maximum height to 200px, here is how you can do it:

/*
SUPER nasty IE8 hack to deal with this bug
*/
pre
{
    max-height: 200px;
    max-height: none\9
}
»  Substance: WordPress   »  Style: Ahren Ahimsa