How to define a long span tag?

The following window is required:

red box

HTML code:

<p>We <span>prefer questions that can be answered, not</span> just discussed.</p> 

It is difficult to get the coordinates of the left and top points in the diagram window.

via:

 outline: 2px red solid; 

can only work in chrome, but does not work in firefox. And also failed in chrome, and the line height <p> is 300%.

+6
source share
2 answers

Same:

CSS

 p { width: 220px; } span { outline: 2px red solid; } 

So, you have a range around what you want, just put an outline on it and execute. Pretty simple ?: D

DEMO HERE

Note. As stated in the comments, this does not work in Firefox. Take a look now.

+10
source

If you know how to use CSS3, use it. Otherwise, please insert the following page into the html page.

 <style type="text/css"> span { border: 5px solid red; } </style> 
-2
source

All Articles