CSS/[removed] How to draw minimal border around an inline element?

后端 未结 1 1181
春和景丽
春和景丽 2021-01-04 12:16

Consider the following HTML:

This is a potentially large paragraph of text, which may get wrapped onto several lines when displayed in

相关标签:
1条回答
  • 2021-01-04 12:45

    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>

    0 讨论(0)
提交回复
热议问题