Apply a class to a br tag?
Solution 1:
Yes.
See the specification.
The class
attribute applies to "HTML Elements" (which includes br
elements).
Solution 2:
One application I can think off is adding using it with pseudo-elements, such as :before
or :after
, for instance adding some text beneath a horizotal line:
hr.something:after { content: "Some text" }
Solution 3:
Yes, is valid.
Specification tells that br
accepts global and event attributes, and class
is a global one.
Note that if you target HTML4 and below, there's an specific attribute for br
named clear
, which defines where to put the new line, as stated here, but now is deprecated and unless your DOCTYPE lets you, you should not use it anymore.