Reputation: 31
I want to change the mouse cursor over the text in a certain div. If I use:
.divchange { cursor: pointer;}
the cursor will change over the whole div and not just over the text.
Upvotes: 1
Views: 18730
Reputation: 1488
You can place a text in span or you can add hover to the certain text.
Using Hover
.text p:hover {cursor: pointer;}
<div class="text">
<p>Hello</p>
</div>
Or just adding style to that element where you want cursor to be a pointer
.text p{cursor: pointer;}
<div class="text">
<p>Hello</p>
</div>
Upvotes: 3
Reputation: 10264
.divchange {
display: inline-block;
cursor: pointer;
}
<div style="background:gray">
<div class="divchange">text only</div>
</div>
The point is display:inline-block
.
Upvotes: 3