Skip to content

Commit 8187b9a

Browse files
authored
Merge pull request #20869 from twbs/static-control
v4 Static form control sizing
2 parents fc13ac2 + 9ac7e86 commit 8187b9a

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

docs/components/forms.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,14 +516,14 @@ Should you have no text within the `<label>`, the input is positioned as you'd e
516516

517517
## Static controls
518518

519-
When you need to place plain text next to a form label within a form, use the `.form-control-static` class on a `<p>`.
519+
When you need to place plain text next to a form label within a form, use the `.form-control-static` class on an element of your choice. Using an element like `<p>` with a default margin? Be sure to use a margin override (as shown below).
520520

521521
{% example html %}
522522
<form>
523523
<div class="form-group row">
524524
<label class="col-sm-2 col-form-label">Email</label>
525525
<div class="col-sm-10">
526-
<p class="form-control-static">[email protected]</p>
526+
<p class="form-control-static mb-0">[email protected]</p>
527527
</div>
528528
</div>
529529
<div class="form-group row">

scss/_forms.scss

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,11 @@ select.form-control {
132132
// horizontal form layout.
133133

134134
.form-control-static {
135-
min-height: $input-height;
136-
// Size it appropriately next to real form controls
137135
padding-top: $input-padding-y;
138136
padding-bottom: $input-padding-y;
139-
// Remove default margin from `p`
140-
margin-bottom: 0;
137+
line-height: $input-line-height;
138+
border: solid transparent;
139+
border-width: 1px 0;
141140

142141
&.form-control-sm,
143142
&.form-control-lg {

0 commit comments

Comments
 (0)