Sign in
Log inSign up

How to display long code so itʼs easy to copy both by hand and by selecting it?

Gergely Polonkai's photo
Gergely Polonkai
·Jan 12, 2018

I generate one-shot passwords (think app passwords on Facebook) in my Web app. These are 32 characters long hexadecimal strings.

I want to display them in a way so it is easy to copy using pen and paper (ie. group by four characters like 600d deed), but I donʼt want these “grouping spaces” to appear in the copied text if the user selects it in the browser to copy/paste it to another app.

Is there a CSS or HTML trick for this?