Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

About this user

Austin Govella http://thinkingandmaking.com

« Newer Snippets
Older Snippets »
6 total  XML / RSS feed 

appendInputTypeClasses() - IE attribute selectors for form inputs

(Stolen from Jeremy Keith and Dustin Diaz: http://domscripting.com/blog/display/38).

Unobtrusive script takes a form inputs type attribute and copies it to that input's class. So, you go from...

<input type="text" />


...to...

<input type="text" class="text" />


Basically allows attribute selectors for form until IE catches up.

/*
        form.js
        AUTH: Austin Govella ([email protected])
        DATE: 2006-07-01
        DESC: Includes form specific javascripts.
        NOTE: Stolen from Jeremy Keith and Dustin Diaz: http://domscripting.com/blog/display/38
        REVS:  
*/



function appendInputTypeClasses()
{       /* adds input type as the inputs class */
        if ( !document.getElementsByTagName ) return;

        var inputs = document.getElementsByTagName('input');
        var inputLen = inputs.length;
        for ( i=0; i < inputLen; i++ )
        {
                if ( inputs[i].getAttribute('type') )
                {
                        inputs[i].className += ' '+inputs[i].getAttribute('type');
                }
        }
}

Baseline CSS FINAL - 2006-07-01

Resets CSS so all browsers are the same, and sets a cross-browser base font size (verdana 13px)

body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,pre,form,fieldset,input,p,blockquote,th,td{margin:0;padding:0;}
table{border-collapse:collapse;border-spacing:0;}
fieldset,img{border:0;}
cite,code,em,strong,th{font-style:normal;font-weight:normal;}
ol,ul{list-style:none;}
th{text-align:left;}
h1,h2,h3,h4{font-size:100%;}
q:before,q:after{content:'';}
body{font:13px verdana,sans-serif;*font-size:small;*font:x-small;}
table{font-size:inherit;font:100%;}
select,input,textarea{font:99% verdana,sans-serif;}
pre,code{font:115% monospace;*font-size:100%;}
body*{line-height:1.22em;}

Baseline CSS - 2006-07-01

Base font-sizing added to base.css

/*
        Reset default styles // base.css
        AUTH: Austin Govella (austin.govella@gmail.com)
        DATE: 2006-05-11
        DESC: Resets default styles for all browsers (merges Tantek Celik's undohtml.css and Yahoo's reset.css), and
              sets base font size to 13px verdana (based on Y!'s fonts.css).
        NOTE: Included in main.css w/ @import
        REVS: 2006-05-12 - Removed elements not commonly used - ACG
              2006-07-01 - Added base font sizing - ACG 
*/



/* Reset default styles across browsers
---------------------------------------- */
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,pre,form,fieldset,input,p,blockquote,th,td{margin:0;padding:0;}
table{border-collapse:collapse;border-spacing:0;}
fieldset,img{border:0;}
cite,code,em,strong,th{font-style:normal;font-weight:normal;}
ol,ul{list-style:none;}
th{text-align:left;}
h1,h2,h3,h4{font-size:100%;}
q:before,q:after{content:'';}



/* Set uniform base font size
---------------------------------------- */
body{font:13px verdana,sans-serif;*font-size:small;*font:x-small;}
table{font-size:inherit;font:100%;}
select,input,textarea{font:99% verdana,sans-serif;}
pre,code{font:115% monospace;*font-size:100%;}
body * {line-height:1.22em;}

Baseline CSS FINAL - 2006-05-12

CSS to remove default spacing and presentation formatting. Provides a consistent blank slate across all browsers.

body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,pre,form,fieldset,input,p,blockquote,th,td{margin:0;padding:0;}
table{border-collapse:collapse;border-spacing:0;}
fieldset,img{border:0;}
cite,code,em,strong,th{font-style:normal;font-weight:normal;}
ol,ul{list-style:none;}
th{text-align:left;}
h1,h2,h3,h4{font-size:100%;}
q:before,q:after{content:'';}


349 bytes

Baseline CSS - 2006-05-12

Slightly reduced version of baseline css. Removies elements that don't usually occur in web development.

/*
        Reset default styles // base.css
        AUTH: Austin Govella (austin.govella@gmail.com)
        DATE: 2006-05-11
        DESC: Resets default styles for all browsers. Merges Tantek Celik's undohtml.css and Yahoo's reset.css
        NOTE: Included in main.css w/ @import
        REVS: Removed elements not commonly used - ACG - 2006-05-12
*/
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,pre,form,fieldset,input,p,blockquote,th,td{margin:0;padding:0;}
table{border-collapse:collapse;border-spacing:0;}
fieldset,img{border:0;}
cite,code,em,strong,th{font-style:normal;font-weight:normal;}
ol,ul{list-style:none;}
th{text-align:left;}
h1,h2,h3,h4{font-size:100%;}
q:before,q:after{content:'';}


668 bytes

Baseline css - remove default browser styles

/*
        Reset default styles // base.css
        AUTH: Austin Govella (austin.govella@gmail.com)
        DATE: 2006-05-11
        DESC: Resets default styles for all browsers. Merges Tantek Celik's undohtml.css and Yahoo's reset.css
        NOTE: Included in main.css w/ @import
*/
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,p,blockquote,th,td{margin:0;padding:0;}
table{border-collapse:collapse;border-spacing:0;}
fieldset,img{border:0;}
address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}
ol,ul{list-style:none;}
caption,th{text-align:left;}
h1,h2,h3,h4,h5,h6{font-size:100%;}
q:before,q:after{content:'';}


650 bytes
« Newer Snippets
Older Snippets »
6 total  XML / RSS feed