diff options
author | Mark Otto <markd.otto@gmail.com> | 2020-10-28 06:45:48 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-28 06:45:48 +0300 |
commit | 3e2f9ab237e0e338fbe497213ad2353e59fbee9c (patch) | |
tree | d1f1843ce62f3c5754e46f0df8eceb4d67a9b72d /site/content/docs/5.0/examples | |
parent | 582f52e9e147c5386d07f241a74a185175cc461d (diff) |
v5: Floating labels (#30449)
* v5: Promote floating labels example to component
- Adds new .form-floating
- Stubs out basics of a docs page
- Removes existing Example
* Update floating labels to support .form-select, make inputs and selects more consistent
- To do this, I made the .form-control and .form-select consistent in min-height vs height
- Removed some unused variables now
- Updated -color to be the -color because I don't know why this was any different before
- Update page to include some examples for layout, validation, and value
- Rewrite styles to not modify padding, but instead transform and opacity
* Streamline and bulletproof some things
- Apply some optimizations from code review
- Removed unecessary properties from the label
- Add some comments for what properties are required
- Move from fixed height for labels to height 100% so we can support textareas
- Improve docs a little bit, add ToC
* Move some values to variables, switch from scaling font-size to scale, update transforms
* Bring over changes from #30966 and add to them to tighten things up
* Delete the now unused example images
* Fix typo
* Allowlist the calc function
* Add transform-origin, update transform values
* Test out autofill fix
* Fix linter issue
* Mention it in the migration guide
* Bump bundlesize
* Add one more variable per review
* Shave .25rem off the height
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Diffstat (limited to 'site/content/docs/5.0/examples')
-rw-r--r-- | site/content/docs/5.0/examples/floating-labels/floating-labels.css | 101 | ||||
-rw-r--r-- | site/content/docs/5.0/examples/floating-labels/index.html | 35 |
2 files changed, 0 insertions, 136 deletions
diff --git a/site/content/docs/5.0/examples/floating-labels/floating-labels.css b/site/content/docs/5.0/examples/floating-labels/floating-labels.css deleted file mode 100644 index 9092659d06..0000000000 --- a/site/content/docs/5.0/examples/floating-labels/floating-labels.css +++ /dev/null @@ -1,101 +0,0 @@ -html, -body { - height: 100%; -} - -body { - display: flex; - align-items: center; - padding-top: 40px; - padding-bottom: 40px; - background-color: #f5f5f5; -} - -.form-signin { - width: 100%; - max-width: 420px; - padding: 15px; - margin: auto; -} - -.form-label-group { - position: relative; - margin-bottom: 1rem; -} - -.form-label-group input, -.form-label-group label { - height: 3.125rem; - padding: .75rem; -} - -.form-label-group label { - position: absolute; - top: 0; - left: 0; - display: block; - width: 100%; - color: #495057; - pointer-events: none; - cursor: text; /* Match the input under the label */ - border: 1px solid transparent; - border-radius: .25rem; - transition: all .1s ease-in-out; -} - -.form-label-group input::-webkit-input-placeholder { - color: transparent; -} - -.form-label-group input::-moz-placeholder { - color: transparent; -} - -.form-label-group input::-ms-input-placeholder { - color: transparent; -} - -.form-label-group input::placeholder { - color: transparent; -} - -.form-label-group input:not(:-moz-placeholder-shown) { - padding-top: 1.25rem; - padding-bottom: .25rem; -} - -.form-label-group input:not(:placeholder-shown) { - padding-top: 1.25rem; - padding-bottom: .25rem; -} - -.form-label-group input:not(:-moz-placeholder-shown) ~ label { - padding-top: .25rem; - padding-bottom: .25rem; - font-size: 12px; - color: #777; -} - -.form-label-group input:not(:placeholder-shown) ~ label { - padding-top: .25rem; - padding-bottom: .25rem; - font-size: 12px; - color: #777; -} - -/* Fallback for Edge --------------------------------------------------- */ -@supports (-ms-ime-align: auto) { - .form-label-group { - display: flex; - flex-direction: column-reverse; - } - - .form-label-group label { - position: static; - } - - .form-label-group input::-ms-input-placeholder { - color: #777; - } -} diff --git a/site/content/docs/5.0/examples/floating-labels/index.html b/site/content/docs/5.0/examples/floating-labels/index.html deleted file mode 100644 index e0e5320bc4..0000000000 --- a/site/content/docs/5.0/examples/floating-labels/index.html +++ /dev/null @@ -1,35 +0,0 @@ ---- -layout: examples -title: Floating labels example -extra_css: - - "floating-labels.css" -include_js: false ---- - -<main class="form-signin"> - <form> - <div class="text-center mb-4"> - <img class="mb-4" src="/docs/{{< param docs_version >}}/assets/brand/bootstrap-logo.svg" alt="" width="72" height="57"> - <h1 class="h3 mb-3 font-weight-normal">Floating labels</h1> - <p>Build form controls with floating labels via the <code>:placeholder-shown</code> pseudo-element. <a href="https://caniuse.com/#feat=css-placeholder-shown">Works in latest Chrome, Safari, and Firefox.</a></p> - </div> - - <div class="form-label-group"> - <input type="email" id="inputEmail" class="form-control" placeholder="Email address" required autofocus> - <label for="inputEmail">Email address</label> - </div> - - <div class="form-label-group"> - <input type="password" id="inputPassword" class="form-control" placeholder="Password" required> - <label for="inputPassword">Password</label> - </div> - - <div class="checkbox mb-3"> - <label> - <input type="checkbox" value="remember-me"> Remember me - </label> - </div> - <button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button> - <p class="mt-5 mb-3 text-muted text-center">© 2017-{{< year >}}</p> - </form> -</main> |