I using Angular2 and I have a div where I am displaying several lines of text. I have a button below the text. When I click on it, I want to have the whole text in div appear selected (like it happens when you manually select an area of text with blue background for text. Here is my div:
<div #ins class="xyz" innerHTML="{{ 'sometext' | translate }}"></div>
I can create a class with background-color of 'blue' and apply to the div when the button is clicked, but that makes the entire div blue. I want to show only the text part with background blue (just like it happens when you manually select the text) instead of the entire div. How can I achieve that?
Test Text
`, styling the background colour of the `` tag should do what youre after – mast3rd3mon Jan 02 '18 at 16:18element. My html string has
for line breaks (that I need to give to separate lines) and I see whitespace between lines then – user1892775 Jan 02 '18 at 17:33