css - What's the best way to not display default input styles? -


does know nice way of hiding default styles inputs, such text, textarea, range, radio buttons / checkboxes etc?

i include following code projects:

css

input[type="text"], input[type="email"], input[type="url"], textarea, select {     -webkit-appearance: none;     -moz-appearance: none;     -ms-appearance: none;     -o-appearance: none;     appearance: none; } 

which works greats inputs such text, teaxtarea , select, others?

i use following code radio , checkboxes:

css

-webkit-transform: translatey(-50%); -moz-transform: translatey(-50%); -ms-transform: translatey(-50%); -o-transform: translatey(-50%); transform: translatey(-50%); appearence: none; 

but best way?

finally onto range, use:

css

input[type=range] {     -webkit-appearance: none; /* hides slider custom slider can made */     width: 100%; /* specific width required firefox. */ } input[type=range]::-webkit-slider-thumb {     -webkit-appearance: none; } input[type=range]:focus {     outline: none; /* removes blue border. not great accessibility. */ } 

accessibility:

from design point of view no many people default outline when focus on input, prefer others style outline accordingly design of project. what's best way this?

you have need, @ least desktop browsers.

for ios textboxes, you'll want add couple extras:

input[type="text"],input[type="email"],input[type="url"],textarea {     -webkit-appearance: none;     -moz-appearance: none;     -ms-appearance: none;     -o-appearance: none;     appearance: none;     outline: none; //important!     border: none; } 

as radio buttons, using css transformations purposes other 3d, viewport, , animations argued bad practice. 1 away on average form; however, having large form dozens of inputs 1 notice huge lag if viewed on lower-end device. due css3 using graphics acceleration. hardware acceleration thing, if used right. instance, 3d viewport animation. have less lag when accelerated because dom trees/layers formed vector , sent graphics card. realize computers have graphics cards, more , more people using tablets , such, graphics cards don't have glory. anyway, here's should radios instead, more cross-browser (css2):

input[type=radio] {   display      : inline-block;   margin-left  : -28px;   padding-left : 28px;   background   : url('radio.png') no-repeat 0 0;   line-height  : 24px; } 

using negative margin positive padding trick, can push old radio control off edge , use background image. sure use <label> these! ensure remain clickable on browsers.

that's got, there lot of methods out there, , answer here surely isn't definitive.

enjoy!


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -