I recently wondered whether it's possible to style a block of text *contained
within a single element* such that wrapped lines are indented. This is
particularly useful when dealing with code snippets, which are typically
inserted between `<pre><code>` and `</code></pre>`. For example?
<pre><code>Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Sed sit amet diam sit amet sem accumsan faucibus ac in arcu.
Quisque varius, erat vel euismod ornare, libero orci laoreet velit, at
lobortis sem nisl et eros.</code></pre>
? would perhaps be rendered as?
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Sed sit amet diam sit amet sem accumsan faucibus ac in arcu.
Quisque varius, erat vel euismod ornare, libero orci laoreet velit,
at lobortis sem nisl et eros.
Here, the last line of "code" has been wrapped due to its length; this is
made apparent to the reader via indentation.
I posed this question on Stack
Overflow<http://stackoverflow.com/questions/3477625/is-it-possible-to
Similar:
- Splitting a string in ASP Classic So here’s my string: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam elit lacus, dignissim quis laoreet non, cursus id eros. Etiam lacinia tortor...
- Splitting a string intelligently in VB.net I want to break a string into chunks of 200 characters or smaller, but breaking at the spaces. How can I do this in VB.net?...
- Static-to-Absolute menu problems… I’m trying to create a menu that is initially static, but after the page has been scrolled down to a certain point, the menu then...
- Static-to-Absolute menu problems… I’m trying to create a menu that is initially static, but after the page has been scrolled down to a certain point, the menu then...
- Float not working Hi, I’m new to Sitepoint. How am I supposed to let people see my code? I guess I’ll just have to include it here… :confused:...