joriszwart.nl

I code dreams™

CSS word wrap indicators

CSS

No comment.

The CSS

pre {
    background: white;
    padding: 1em 2em
}

code {
    background: inherit;
    display: inline-block;
    padding-right: 2em;
    position: relative;
    white-space: pre-wrap
}

code::after {
    background: inherit;
    content: "  ";
    position: absolute
}

code::before {
    color: gray;
    content: "↩";
    position: absolute;
    right: 1em;
    top: 0
}

The HTML

<pre>
<code>if r.Authenticated {</code>
<code>    fmt.Println(r.User, "is authenticated")</code>
<code>}</code>
</pre>