I have code like the below. Instead of having the box stretch all the way to the right how do i make it only as long as it needs to be?
<html><body>
<pre style="{border-style:solid;}">A Sentence</pre>
</body></html>
You could use
<pre style="display: inline; border-style: solid">
(the {}
don't belong in the style block by the way)
That would render the element as an inline object that doesn't occupy full width anymore, but flows like normal text. However, that way, the next following element will follow right next to the pre
, and you may have to add <br>
line breaks.
Using an inner element would be a simple approach:
<html><body>
<pre><span style="border-style:solid;">A Sentence</span></pre>
</body></html>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With