Leo
Leo

Reputation: 4438

Selection of text inside div is shown outside the div

I want the user to select text (html) inside a div. However doing that will show the selection background in the browser also outside the div.

I can prevent that with (see http://jsfiddle.net/lborgman/aWbgT/)

div { overflow: hidden; }

Is that the way to do it? Or, is there a better way?

Upvotes: 0

Views: 103

Answers (2)

Juan
Juan

Reputation: 5050

add a display: inline-b

div { overflow: hidden; display:inline-block; }

demo

Upvotes: 1

tildedash
tildedash

Reputation: 71

There is a typo in the CSS property :

xoverflow: hidden;

instead of

overflow-x: hidden;

Updated JSFiddle : http://jsfiddle.net/aWbgT/3/

Upvotes: 0

Related Questions