Is it possible to construct CSS/HTML that will properly indent wrapped lines with "hanging" parenthetical constructs, like a function call or for loop? I was unable to figure out a way to do it, but maybe there is a mechanism of which I am unaware.
-
-
I’m not aware of any such thing. CSS has remarkably little configuration for inline text at all, much less text wrapping that is sensitive to parentheses.
-
Your best bet is probably to use the <pre> tag and manually format your text. At least that way it will preserve whitespace without you having to mess with padding or whatever.
- Show replies
New conversation -
-
-
I'm not sure whether I'm completely following what you want to do, but there are few ways to adjust idents: 1. text-indent property 2. ::first-line selector Span tags with different text-ident values and block behavior, might do it. Also might glitch.
-
Nevermind ::first-line doesn't allow changing indent/padding/margin. 1. was somewhat dead-end as well https://jsbin.com/focexif/1/edit?html,css,output … ... It is possible to force wrapping at paren https://jsbin.com/focexif/2/edit?html,css,output …, however everything else goes to hell then.
- Show replies
New conversation -
-
-
Those 2 different behaviors are possible with CSS, but you need 2 different CSS classes (or a 1 CSS class override for function call text). So the problem is how do you wrap the function call text "(2, 3, 4, 5)" in that CSS class? Parse on server or with JS and wrap with <span>
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
if each line of code is an element? :first-line
-
That helps literally not at all.
- Show replies
New conversation -
-
-
S we need it. I use to do it manually only.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
Show additional replies, including those that may contain offensive content
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.