css - Line break in :after pseudo-element content lost when pasted into editor -
below well-known method add line break using :after pseudo-element:
<!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <style> .br:after { content: '\a'; white-space: pre; } </style> </head> <body> <span class="br">line 1</span> <span class="br">line 2</span> <span class="br">line 3</span> <span class="br">line 4</span> </body> </html>
the problem when html content copied , pasted browser external editor, e.g. notepad or word, line breaks lost , text above looks as
line 1 line 2 line 3 line 4
any workarounds?
if want each span
element appear on line of own, can set just
.br { display: block; }
if want have line break after span
, while letting go same line preceding content, i’m afraid there’s no solution. clumsy workaround, include visible character in generated content , search , replace in target program replace line break.
Comments
Post a Comment