I have text in a <p>
tag:
<p>Hello world... and goodbye mind A B!</p>
How do I increase the area in which the text is selectable? I know I can increase the font-size
and that would increase the area which is selectable, but is there a better way?
To clarify this question. For example, on mobile screens, I find it difficult to highlight words that are one letter like i
, but if the hit detection would be on a wider area, it would be a lot easier to select it.
How to do it? A mind-teasing puzzle.
Bounty info
Looking for a working cross browser solution. Please read the question thoroughly and the comments before posting an answer to avoid confusion. User @mmm posted a question that's quite close, but in his approach, while the <p>
tag is has a wider hit detection (perfect!), it auto-selects upon click. I need the user to interact with the <p>
tag just like we do with normal text based <p>
tags... however with a larger hit detector.
EDIT
Further clarification. As an example, the selection area for a comment to this very question is this large:
You can find this comment below. Hover your cursor over it until the cursor gets changed to cursor:text
. That's the default selection area.
But my aim is to extend it to a larger area, like this:
tag via JS and click on it on your mobile screen, if you aim for a single-letter word, then you need to have the fingers of Deadpool when he had it cut off and regenerated in order to click on the single-word letter unless if the font-size is **massive**. Hope that explained it. That's just one scenario. :D
– Henrik Petterson Feb 20 '16 at 22:09I am Sam.
` `Sam I am.<\p>` `
I am Sam.
` 1. Will there be particular paragraphs/divs that you would like the text to be more selectable in? That is to say, in the example above, might you like the 'I' in '*Sam I am*' to be selectable? Or would you want all given 'I's on a page to be more selectable? – J. Nilles Feb 25 '16 at 03:17Not in a car. Not in a tree.
` 2. Following up, within paragraphs, will there be particular characters that you would like to make more selectable. Thus, in the example above would you like the 'a' in '*Not in a tree.*' to be more selectable but not care about the 'a' in '*Not in a car.*'? – J. Nilles Feb 25 '16 at 03:20I do not like them with a fox.
` 3. Are there particular glyphs/characters that you wish to be more selectable? So, referring to the example above, you might wish to for 'a' to be more selectable but not the 'I'? – J. Nilles Feb 25 '16 at 03:21Sam I am.<\p>` 4. Is it acceptable for the single letter words to be more selectable at the expense of the surrounding words. In the example above, would it be ok to make the 'Sam' and 'am' less selectable in order to make the 'I' more selectable?
– J. Nilles Feb 25 '16 at 03:21`-tags or only a specific one? If specific: would there be a possibility to add a class or id to it?
– Kathara Aug 15 '17 at 07:27