diff --git a/CNAME b/CNAME deleted file mode 100644 index 4af6a08..0000000 --- a/CNAME +++ /dev/null @@ -1 +0,0 @@ -wtfforms.com \ No newline at end of file diff --git a/_config.yml b/_config.yml deleted file mode 100644 index 9a4c9fa..0000000 --- a/_config.yml +++ /dev/null @@ -1,8 +0,0 @@ -name: "WTF, forms?" -url: http://wtfforms.com -repo: https://github.com/mdo/wtf-forms/ -twitter: https://twitter.com/mdo/ - -markdown: redcarpet -permalink: pretty -highlighter: pygments diff --git a/_includes/ads.css b/_includes/ads.css deleted file mode 100644 index 79e791e..0000000 --- a/_includes/ads.css +++ /dev/null @@ -1,48 +0,0 @@ -/* Ads --------------------------------------------------- */ - -#fusionads { - display: block; - padding: 2rem 0; - overflow: hidden; /* clearfix */ - font-size: .85rem; - line-height: 1.3; - background-color: #fff; - border-bottom: 1px solid #eee; -} -.fusion-text, -.fusion-poweredby { - display: block; - color: #999; -} -.fusion-text:hover, -.fusion-poweredby:hover { - color: #08c; - text-decoration: none; -} -.fusion-img { - float: left; - margin-right: 1rem; -} -.fusion-poweredby { - display: block !important; - margin-top: .5rem; -} - -@media (min-width: 50rem) { - #fusionads { - position: fixed; - left: 0; - bottom: 0; - width: 10rem; - padding: 1.5rem; - margin: 0; - font-size: .6rem; - border-bottom: 0; - } - .fusion-img { - float: none; - display: block; - margin-bottom: .5rem; - } -} diff --git a/_includes/checkbox.html b/_includes/checkbox.html deleted file mode 100644 index 269693d..0000000 --- a/_includes/checkbox.html +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/_includes/file.html b/_includes/file.html deleted file mode 100644 index f141103..0000000 --- a/_includes/file.html +++ /dev/null @@ -1,4 +0,0 @@ - \ No newline at end of file diff --git a/_includes/footer.html b/_includes/footer.html deleted file mode 100644 index 189eadd..0000000 --- a/_includes/footer.html +++ /dev/null @@ -1,23 +0,0 @@ - diff --git a/_includes/header.html b/_includes/header.html deleted file mode 100644 index 01a9561..0000000 --- a/_includes/header.html +++ /dev/null @@ -1,17 +0,0 @@ -
-
- -

{{ site.name }}

-

Friendlier HTML form controls with a little CSS magic. Designed for IE9+, as well as the latest Chrome, Safari, and Firefox.

-

Created by @mdo.

- - -
-
diff --git a/_includes/icons.html b/_includes/icons.html deleted file mode 100644 index 7e71071..0000000 --- a/_includes/icons.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - \ No newline at end of file diff --git a/_includes/js.html b/_includes/js.html deleted file mode 100644 index 156ae49..0000000 --- a/_includes/js.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/_includes/radio.html b/_includes/radio.html deleted file mode 100644 index b1c3a85..0000000 --- a/_includes/radio.html +++ /dev/null @@ -1,10 +0,0 @@ - - \ No newline at end of file diff --git a/_includes/select.html b/_includes/select.html deleted file mode 100644 index da01a42..0000000 --- a/_includes/select.html +++ /dev/null @@ -1,8 +0,0 @@ - \ No newline at end of file diff --git a/_includes/syntax.css b/_includes/syntax.css deleted file mode 100644 index 1b3c92c..0000000 --- a/_includes/syntax.css +++ /dev/null @@ -1,66 +0,0 @@ -.hll { background-color: #ffffcc } - /*{ background: #f0f3f3; }*/ -.c { color: #999; } /* Comment */ -.err { color: #AA0000; background-color: #FFAAAA } /* Error */ -.k { color: #006699; } /* Keyword */ -.o { color: #555555 } /* Operator */ -.cm { color: #999; } /* Comment.Multiline */ /* Edited to remove italics and make into comment */ -.cp { color: #009999 } /* Comment.Preproc */ -.c1 { color: #999; } /* Comment.Single */ -.cs { color: #999; } /* Comment.Special */ -.gd { background-color: #FFCCCC; border: 1px solid #CC0000 } /* Generic.Deleted */ -.ge { font-style: italic } /* Generic.Emph */ -.gr { color: #FF0000 } /* Generic.Error */ -.gh { color: #003300; } /* Generic.Heading */ -.gi { background-color: #CCFFCC; border: 1px solid #00CC00 } /* Generic.Inserted */ -.go { color: #AAAAAA } /* Generic.Output */ -.gp { color: #000099; } /* Generic.Prompt */ -.gs { } /* Generic.Strong */ -.gu { color: #003300; } /* Generic.Subheading */ -.gt { color: #99CC66 } /* Generic.Traceback */ -.kc { color: #006699; } /* Keyword.Constant */ -.kd { color: #006699; } /* Keyword.Declaration */ -.kn { color: #006699; } /* Keyword.Namespace */ -.kp { color: #006699 } /* Keyword.Pseudo */ -.kr { color: #006699; } /* Keyword.Reserved */ -.kt { color: #007788; } /* Keyword.Type */ -.m { color: #FF6600 } /* Literal.Number */ -.s { color: #d44950 } /* Literal.String */ -.na { color: #4f9fcf } /* Name.Attribute */ -.nb { color: #336666 } /* Name.Builtin */ -.nc { color: #00AA88; } /* Name.Class */ -.no { color: #336600 } /* Name.Constant */ -.nd { color: #9999FF } /* Name.Decorator */ -.ni { color: #999999; } /* Name.Entity */ -.ne { color: #CC0000; } /* Name.Exception */ -.nf { color: #CC00FF } /* Name.Function */ -.nl { color: #9999FF } /* Name.Label */ -.nn { color: #00CCFF; } /* Name.Namespace */ -.nt { color: #2f6f9f; } /* Name.Tag */ -.nv { color: #003333 } /* Name.Variable */ -.ow { color: #000000; } /* Operator.Word */ -.w { color: #bbbbbb } /* Text.Whitespace */ -.mf { color: #FF6600 } /* Literal.Number.Float */ -.mh { color: #FF6600 } /* Literal.Number.Hex */ -.mi { color: #FF6600 } /* Literal.Number.Integer */ -.mo { color: #FF6600 } /* Literal.Number.Oct */ -.sb { color: #CC3300 } /* Literal.String.Backtick */ -.sc { color: #CC3300 } /* Literal.String.Char */ -.sd { color: #CC3300; font-style: italic } /* Literal.String.Doc */ -.s2 { color: #CC3300 } /* Literal.String.Double */ -.se { color: #CC3300; } /* Literal.String.Escape */ -.sh { color: #CC3300 } /* Literal.String.Heredoc */ -.si { color: #AA0000 } /* Literal.String.Interpol */ -.sx { color: #CC3300 } /* Literal.String.Other */ -.sr { color: #33AAAA } /* Literal.String.Regex */ -.s1 { color: #CC3300 } /* Literal.String.Single */ -.ss { color: #FFCC33 } /* Literal.String.Symbol */ -.bp { color: #336666 } /* Name.Builtin.Pseudo */ -.vc { color: #003333 } /* Name.Variable.Class */ -.vg { color: #003333 } /* Name.Variable.Global */ -.vi { color: #003333 } /* Name.Variable.Instance */ -.il { color: #FF6600 } /* Literal.Number.Integer.Long */ - -.css .o, -.css .o + .nt, -.css .nt + .nt { color: #999; } diff --git a/_includes/tweet-button.html b/_includes/tweet-button.html deleted file mode 100644 index d69fcf0..0000000 --- a/_includes/tweet-button.html +++ /dev/null @@ -1,3 +0,0 @@ -
- Tweet -
diff --git a/_layouts/default.html b/_layouts/default.html deleted file mode 100644 index aea1560..0000000 --- a/_layouts/default.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - {{ site.name }} - - - - - - - - - - - {% include header.html %} - -
- - - {{ content }} -
- - {% include footer.html %} - - {% include js.html %} - - diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..628c237 --- /dev/null +++ b/bower.json @@ -0,0 +1,20 @@ +{ + "name": "wtf-forms", + "description": "Friendlier HTML form controls with a little CSS magic.", + "keywords": [ + "html", + "css", + "forms", + "web" + ], + "homepage": "http://wtfforms.com", + "main": [ + "wtf-forms.css" + ], + "ignore": [ + ".*", + "docs.css", + "index.html", + "font/" + ] +} diff --git a/docs.css b/docs.css index 082f9ba..cd37a2b 100644 --- a/docs.css +++ b/docs.css @@ -1,7 +1,3 @@ ---- -layout: nil ---- - /* * Fonts */ @@ -233,5 +229,68 @@ pre code { * Syntax highlighting */ -{% include syntax.css %} -{% include ads.css %} +.hll { background-color: #ffffcc } +.c { color: #999; } /* Comment */ +.err { color: #AA0000; background-color: #FFAAAA } /* Error */ +.k { color: #006699; } /* Keyword */ +.o { color: #555555 } /* Operator */ +.cm { color: #999; } /* Comment.Multiline */ /* Edited to remove italics and make into comment */ +.cp { color: #009999 } /* Comment.Preproc */ +.c1 { color: #999; } /* Comment.Single */ +.cs { color: #999; } /* Comment.Special */ +.gd { background-color: #FFCCCC; border: 1px solid #CC0000 } /* Generic.Deleted */ +.ge { font-style: italic } /* Generic.Emph */ +.gr { color: #FF0000 } /* Generic.Error */ +.gh { color: #003300; } /* Generic.Heading */ +.gi { background-color: #CCFFCC; border: 1px solid #00CC00 } /* Generic.Inserted */ +.go { color: #AAAAAA } /* Generic.Output */ +.gp { color: #000099; } /* Generic.Prompt */ +.gs { } /* Generic.Strong */ +.gu { color: #003300; } /* Generic.Subheading */ +.gt { color: #99CC66 } /* Generic.Traceback */ +.kc { color: #006699; } /* Keyword.Constant */ +.kd { color: #006699; } /* Keyword.Declaration */ +.kn { color: #006699; } /* Keyword.Namespace */ +.kp { color: #006699 } /* Keyword.Pseudo */ +.kr { color: #006699; } /* Keyword.Reserved */ +.kt { color: #007788; } /* Keyword.Type */ +.m { color: #FF6600 } /* Literal.Number */ +.s { color: #d44950 } /* Literal.String */ +.na { color: #4f9fcf } /* Name.Attribute */ +.nb { color: #336666 } /* Name.Builtin */ +.nc { color: #00AA88; } /* Name.Class */ +.no { color: #336600 } /* Name.Constant */ +.nd { color: #9999FF } /* Name.Decorator */ +.ni { color: #999999; } /* Name.Entity */ +.ne { color: #CC0000; } /* Name.Exception */ +.nf { color: #CC00FF } /* Name.Function */ +.nl { color: #9999FF } /* Name.Label */ +.nn { color: #00CCFF; } /* Name.Namespace */ +.nt { color: #2f6f9f; } /* Name.Tag */ +.nv { color: #003333 } /* Name.Variable */ +.ow { color: #000000; } /* Operator.Word */ +.w { color: #bbbbbb } /* Text.Whitespace */ +.mf { color: #FF6600 } /* Literal.Number.Float */ +.mh { color: #FF6600 } /* Literal.Number.Hex */ +.mi { color: #FF6600 } /* Literal.Number.Integer */ +.mo { color: #FF6600 } /* Literal.Number.Oct */ +.sb { color: #CC3300 } /* Literal.String.Backtick */ +.sc { color: #CC3300 } /* Literal.String.Char */ +.sd { color: #CC3300; font-style: italic } /* Literal.String.Doc */ +.s2 { color: #CC3300 } /* Literal.String.Double */ +.se { color: #CC3300; } /* Literal.String.Escape */ +.sh { color: #CC3300 } /* Literal.String.Heredoc */ +.si { color: #AA0000 } /* Literal.String.Interpol */ +.sx { color: #CC3300 } /* Literal.String.Other */ +.sr { color: #33AAAA } /* Literal.String.Regex */ +.s1 { color: #CC3300 } /* Literal.String.Single */ +.ss { color: #FFCC33 } /* Literal.String.Symbol */ +.bp { color: #336666 } /* Name.Builtin.Pseudo */ +.vc { color: #003333 } /* Name.Variable.Class */ +.vg { color: #003333 } /* Name.Variable.Global */ +.vi { color: #003333 } /* Name.Variable.Instance */ +.il { color: #FF6600 } /* Literal.Number.Integer.Long */ + +.css .o, +.css .o + .nt, +.css .nt + .nt { color: #999; } diff --git a/index.html b/index.html new file mode 100644 index 0000000..d4ede67 --- /dev/null +++ b/index.html @@ -0,0 +1,275 @@ + + + + + + + + + + WTF, forms? + + + + + + + + + + +
+
+ +

WTF, forms?

+

Friendlier HTML form controls with a little CSS magic. Designed for IE9+, as well as the latest Chrome, Safari, and Firefox.

+

Created by @mdo.

+ + +
+
+ + +
+ + +

Checkboxes and radios

+ +
+ +
+
<label class="control checkbox">
+  <input type="checkbox">
+  <span class="control-indicator"></span>
+  Check this custom checkbox
+</label>
+
+
+ + +
+
<label class="control radio">
+  <input type="radio" id="radio1" name="radio">
+  <span class="control-indicator"></span>
+  Toggle this custom radio
+</label>
+<label class="control radio">
+  <input type="radio" id="radio2" name="radio">
+  <span class="control-indicator"></span>
+  Or toggle this other custom radio
+</label>
+
+

Each checkbox and radio is wrapped in a <label> for three reasons:

+ +
    +
  1. It provides a larger hit area for checking the control.
  2. +
  3. It provides a helpful and semantic wrapper to help us replace the default <input>s.
  4. +
  5. It triggers the state of the <input> automatically, meaning no JavaScript is required.
  6. +
+ +

We hide the default <input> with opacity and instead use the <span class="control-indicator"> within the <label> to build a new custom form control.

+ +

With the sibling selector (~), we use the :checked state to trigger a makeshift checked state on the custom control.

+ +

In the checked states, we use base64 embedded SVG icons from Open Iconic. This provides us the best control for styling and positioning across browsers and devices.

+ +

Alternate icons

+ +

By default, checkboxes use a checkmark and radios use an filled circle. Also included are two modifier classes, .control-x and .control-dash, to change things up should the need arise.

+ +
+ + + + +
+ +

Add the modifier classes to the <label>, like so:

+
<label class="control checkbox control-x">...</label>
+
+

Want to customize the icons further, or use other ones? Download Open Iconic—included are font files, PNGs, and SVGs.

+ +

Select menu

+ +
+ +
+
<label class="select">
+  <select>
+    <option selected>Open this select menu</option>
+    <option value="1">One</option>
+    <option value="2">Two</option>
+    <option value="3">Three</option>
+  </select>
+</label>
+
+

Similar to the checkboxes and radios, we wrap the <select> in a <label> as a semantic wrapper that we can generate custom styles on with CSS's generated content.

+ +

The <select> has quite a few styles to override and includes a few hacks to get things done. Here's what's happening:

+ + + +

Heads up! This one comes with some quirks right now:

+ + + +

Any ideas on improving these are most welcome.

+ +

Multiple select

+ +
+ +
+ +

File browser

+ +
+ +
+
<label class="file">
+  <input type="file" id="file">
+  <span class="file-custom"></span>
+</label>
+
+

The file input is the most gnarly of the bunch. Here's how it works:

+ + + +

In other words, it's an entirely custom element, all generated via CSS.

+ +

Heads up! The custom file input is currently unable to update the Choose file... text with the filename. Without JavaScript, this might not be possible to change, but I'm open to ideas.

+ +

FAQs

+ +

What about every other form control?

+ +

For the time being, WTF, forms? is limited to checkboxes, radio buttons, select menus, and file inputs. Additional custom inputs will depend on browser support.

+ +

Why are there no for attributes?

+ +

We nest our <input>s and <select>s within a <label>, so there's no need to specify a for attribute as the browser will automatically associate the two.

+ +

What about hover states?

+ +

Basic hover styles have been included, but they've been commented out because they are sticky on iOS. Uncomment if you really need it.

+ +

Does this require JavaScript?

+ +

Not for the time being, however, the file input might be better off with it.

+ +

Will this be added to Bootstrap?

+ +

Possibly, but not until v4 at the earliest.

+ +

Is this screen reader friendly?

+ +

Honestly, no idea right now.

+ +

Changelog

+ +

For a full changelog, visit the releases page on GitHub.

+ +

This project utilizes SemVer for versioning releases for maximum backward compatibility.

+ +
+ + + + + + + + diff --git a/index.md b/index.md deleted file mode 100644 index dae25ef..0000000 --- a/index.md +++ /dev/null @@ -1,174 +0,0 @@ ---- -layout: default ---- - -### Checkboxes and radios - -
- {% include checkbox.html %} -
-```html -{% include checkbox.html %} -``` - -
- {% include radio.html %} -
-```html -{% include radio.html %} -``` - -Each checkbox and radio is wrapped in a `