Skip to content

Commit 9ea454d

Browse files
Merge pull request AllThingsSmitty#174 from Raymond-Adams/patch-1
Update Form Element Font Tip
2 parents eafe45b + 1ecb45e commit 9ea454d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ A collection of tips to help take your CSS skills pro.
4141
1. [Use `rem` for Global Sizing; Use `em` for Local Sizing](#use-rem-for-global-sizing-use-em-for-local-sizing)
4242
1. [Hide Autoplay Videos That Aren't Muted](#hide-autoplay-videos-that-arent-muted)
4343
1. [Use `:root` for Flexible Type](#use-root-for-flexible-type)
44-
1. [Set `font-size` on Form Elements for a Better Mobile Experience](#set-font-size-on-form-elements-for-a-better-mobile-experience)
44+
1. [Inherit `font` on Form Elements for a Better Mobile Experience](#inherit-font-on-form-elements-for-a-better-mobile-experience)
4545
1. [Use Pointer Events to Control Mouse Events](#use-pointer-events-to-control-mouse-events)
4646
1. [Set `display: none` on Line Breaks Used as Spacing](#set-display-none-on-line-breaks-used-as-spacing)
4747
1. [Use `:empty` to Hide Empty HTML Elements](#use-empty-to-hide-empty-html-elements)
@@ -578,20 +578,20 @@ body {
578578
<sup>[back to table of contents](#table-of-contents)</sup>
579579

580580

581-
### Set `font-size` on Form Elements for a Better Mobile Experience
581+
### Inherit `font` on Form Elements for a Better Mobile Experience
582582

583-
To avoid mobile browsers (iOS Safari, _et al_.) from zooming in on HTML form elements when a `<select>` drop-down is tapped, add `font-size` to the selector rule:
583+
Some form controls do not inherit typographical styles by default. To avoid mobile browsers (iOS Safari, _et al_.) from zooming in on HTML form elements when a `<select>` drop-down is tapped, and to mitigate styling inconsistencies across browsers, set the `font` rule to `inherit`:
584584

585585
```css
586-
input[type="text"],
587-
input[type="number"],
586+
input,
587+
button,
588588
select,
589589
textarea {
590-
font-size: 16px;
590+
font: inherit;
591591
}
592592
```
593593

594-
:dancer:
594+
Learn more in [MDN's guide to styling web forms](https://developer.mozilla.org/en-US/docs/Learn/Forms/Styling_web_forms).
595595

596596
<sup>[back to table of contents](#table-of-contents)</sup>
597597

0 commit comments

Comments
 (0)