css select text inside div

Solutions on MaxInterview for css select text inside div by the best coders in the world

showing results for - "css select text inside div"
Ornella
16 Mar 2019
1CSS doesn't work this way. As biziclop says in the comments, text nodes can't be selected with CSS. You'll either have to wrap your text in a <span> and use
2
3.test span {
4    cursor: pointer;
5}
6With
7
8<div class="test">
9    <span>Text</span>
10</div>
11Or set .test to display: inline, but that won't let you give it a width, which is not the behaviour you want. <span>s are fine, in this case.