Consider the following HTML:
<p>This is a potentially large paragraph of text, which <span>may get 
wrapped onto several lines when displayed in the browser.
I would like to be able to draw a minimal</span> box round the span</p>
I would like to draw a minimal border round the span.
That is:
I am fairly confident this cannot be done with raw CSS alone (in the second case). Solutions involving javascript libraries, or those which are Firefox-specific, are acceptable.
This is a mock-up of how the second scenario should look:

Consider adding an outline, not border http://jsfiddle.net/tarabyte/z9THQ/
span {
  outline: 2px solid black;   
}
Firefox draws outline between lines. There is a workarond: http://jsfiddle.net/z9THQ/2/
.wrapped {
   outline: 2px solid black;
}
.wrapped span {
    border: 1px solid white;
    background-color: white;
    position: relative;
    z-index: 1000;
}
<p>
   This is a potentially large paragraph of text, which 
      <span class="wrapped"><span> 
        may get wrapped onto several lines when displayed in the browser. I would like to be able to draw a minimal
      </span></span> 
   box round the span
</p>
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