Skip to content

Commit 2c46963

Browse files
committed
Merge pull request symfony#3250 from bicpi/asterisk_alternative_for_required_form_fields
[Cookbook][Forms] Add Asterisk alternative using CSS
2 parents 357f10b + 2a53133 commit 2c46963

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

cookbook/form/form_customization.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,17 @@ original template:
896896

897897
See :ref:`cookbook-form-theming-methods` for how to apply this customization.
898898

899+
.. sidebar:: Using CSS only
900+
901+
By default, ``label`` tags of required fields are rendered with a
902+
``required`` CSS class. Thus, you can also add an Asterisk using CSS only:
903+
904+
.. code-block:: css
905+
906+
label.required:before {
907+
content: "* ";
908+
}
909+
899910
Adding "help" messages
900911
~~~~~~~~~~~~~~~~~~~~~~
901912

0 commit comments

Comments
 (0)