Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8928837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:32:20+00:00 2026-06-15T08:32:20+00:00

Consider the following HTML: <p>This is a potentially large paragraph of text, which <span>may

  • 0

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:

  • If the span is rendered on a single line, the border is equivalent to setting a CSS style of border: 1px solid black;
  • If the span is rendered on multiple lines, the border is drawn around the outermost edges of the span, not between the lines which it crosses. This is equivalent to setting a CSS background color on the span, and drawing the line around the edges of the highlighted area.

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:

Second scenario mock-up

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:32:21+00:00Added an answer on June 15, 2026 at 8:32 am

    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
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following document <html> <body> This is some content <script type=text/javascript src=verySlowToRespond.js></script> This
Please consider the following non-working HTML document: <html> <body> <form action= method=GET onsubmit=return f(this);>
Consider the following html page, which can load in many large png files: <html>
Consider the following HTML string: <p>This is line 1 <br /> and this is
This problem is only in IE. Consider the following HTML: <html> <body> <div style='position:absolute;left:1em;right:1em;top:1em;bottom:1em;overflow:auto;>
Consider the following HTML/css code sample: <div id="container"> <div id="up">Text<br />Text<br />Text<br /></div> <div
Consider the following html snippet <!DOCTYPE html> <html> <head> <script type=text/javascript src=http://code.jquery.com/jquery-1.4.2.js ></script> <script
Please consider the following HTML: <td> Some Text <table>.....</table> </td> I need to manipulate
Consider this HTML: <form id=MyForm> <input name=Input1/> </form> To get the form, I would
Consider the following example: HTML: <div id=cool-div></div> JS/jQuery: var ComplexObject = function() { this.Append

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.