문제

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?

도움이 되었습니까?

해결책

add a display: inline-b

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

demo

다른 팁

There is a typo in the CSS property :

xoverflow: hidden;

instead of

overflow-x: hidden;

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top