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>
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>
Using an inner element would be a simple approach:
<html><body>
<pre><span style="border-style:solid;">A Sentence</span></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.
positioning the element should help
<html><body>
<pre style="border-style:solid; position:absolute;">A Sentence</pre>
</body></html>