Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <h1>Styling Forms</h1>
<h2>If <code>[type=textish]</code>, <code>[type=buttonish]</code>, &amp; <code>[type=togglable]</code> Existed in CSS</h2>


HTML has a lot of great input types, but it's hard to style all of them the way you want without accidentally styling other things. The dozen input types, checkboxes, radio buttons, select boxes, textareas - all of these elements really only fall three 'categories' of input that we can grab and style accordingly:

- textish
- buttonish
- togglable

So why can't we style all things that look like <input type=text> with something like: input[type=textish]?

This is my experiment to see if there are more effective ways of selecting input elements to style them.

I created a list of selectors we want to target in JavaScript, and then used EQCSS to allow us to use that variable name in our CSS and insert the entire list of selectors. This also allows us to write functions that alter how that list of selectors is returned to us, so we can easily add :hover, :focus, :active and other modifications to our selectors fairly easily.


<!-- Text-like -->
<input type=hidden placeholder=hidden>
<input type=text placeholder=text>
<input type=search placeholder=search>
<input type=tel placeholder=tel>
<input type=url placeholder=url>
<input type=email placeholder=email>
<input type=password placeholder=password>
<input type=date placeholder=date>
<input type=month placeholder=month>
<input type=week placeholder=week>
<input type=time placeholder=time>
<input type=datetime-local placeholder=datetime-local>
<input type=number placeholder=number>
<input type=range placeholder=range>
<input type=color placeholder=color>

<!-- Toggle-like -->
<input type=checkbox value=checkbox>
<input type=checkbox value=checkbox>
<input type=checkbox value=checkbox>
<input type=radio name=radio value=radio>
<input type=radio name=radio value=radio>
<input type=radio name=radio value=radio>

<!-- Button-like-->
<input type=file value=file>
<input type=submit value=submit>
<input type=reset value=reset>
<input type=button value=button>
<button>real button</button>


                @element input, textarea, select, button {

  /* set width for most inputs */
  select {
    display: block;
    width: 100%;

  /* Give default style to text inputs and buttons */
  select {
    -webkit-appearance: none;
    appearance: none;
    padding: .5em;
    min-height: 2em;
    margin: .5em 0;
    color: #555;
    background-color: white;
    border: 1px solid rgba(0,0,0,.3);
    border-radius: 0;
    line-height: 1;
    font-size: 12pt;
    font-weight: 400;
    font-family: 'Source Sans', sans-serif;

  /* Set border radius on buttons and select */
  select {
    min-height: 0;
    border-radius: 3px;
    cursor: pointer;

  /* enhance button styles */
  eval('buttonish') {
    background-color: transparent;

  /* size togglable inputs */
  eval('togglable') {
    min-height: 1em;
    display: inline-block;
    cursor: pointer;
  [type=radio] {
    border-radius: 100%;
  eval('action("checked",togglable)') {
    background-color: #999;
    box-shadow: inset white 0 1px 0,
                inset white 1px 0 0,
                inset white -1px 0 0,
                inset white 0 -1px 0;
  /* add min-height to textarea */
  textarea {
    min-height: 5em;

  /* enhance select */
  select {
    padding-right: 1.5em;
    text-indent: 0.01px;
    text-overflow: '';
    background-repeat: no-repeat;
    background-position: calc(100% - .5em) 50%;
    background-size: 12px;
    background-image: url("data:image/svg+xml;charset=utf8, %3Csvg xmlns='' viewBox='0 0 16 16'%3E %3Cpolygon opacity='0.6' points='0,4 16,4 8,12'/%3E %3C/svg%3E ");
  select::-ms-expand {
    display: none;

  /* input & select hover styles */
  select:hover {
    border: 1px solid gold;

  /* input & select focus styles */
  select:focus {
    background-color: lightyellow;

  /* button hover styles */
  eval("action('hover',buttonish)") {
    color: white;
    background-color: #999;

  /* button focus styles */
  eval("action('active',buttonish)") {
    color: white;
    background-color: #555;

  /* fix type=search padding */
  [type=search] {
    padding-right: 0;


                /* selector lists */
var textish = [
  '[type=text]', '[type=search]', '[type=tel]', '[type=url]', '[type=email]', '[type=password]', '[type=date]', '[type=month]', '[type=week]', '[type=time]', '[type=datetime-local]', '[type=number]', '[type=color]', 'textarea'
var togglable = [
  '[type=checkbox]', '[type=radio]'
var buttonish = [
  '[type=submit]', '[type=reset]', '[type=button]', 'button'

/* return selectors with :states using action('state',arrayName) */
function action(state,array){
  var selectors ='';
    selectors += array[i]+':'+state
    if (i<array.length-1) {
      selectors += ', '
  return selectors