+ 2
How i can do this in CSS?
I have created this code. I want that when the user hover on div which has an id x then the colour of the p tag changed to blue. how i can do this with only CSS and HTML without javascript. https://code.sololearn.com/WGKImQSMI7wq/?ref=app
19 Réponses
+ 8
https://code.sololearn.com/W6fHo8Miy8J4/?ref=app
This (+)selector only works if the p is immediately after the #x(div) tag in the example.
+ 4
Hello,
Here’s a help...
I changed a bit of your code. Feel free to change the code.
https://code.sololearn.com/WWrn4zDWA4TT/?ref=app
+ 4
What about now?
+ 4
Nice... It’s all yours :)
#HappyCoding
+ 4
JTLZ what ,no let i have two div which one has an id x and another one has an id y.if i hover on x id div then the background colour of div whose id y changed.
But the condition is that no anyone is inside them.
+ 4
Nope we are diffrent WhyFry lol
+ 4
WhyFry Why do I want two accounts lol 😂. I am just helping Maninder $ingh
Then it came to me that question “hover Css” so i asked it with the code I created to help Maninder
+ 3
https://code.sololearn.com/Wayn2N88u1eW/?ref=app
I didn't know what you mean because :hover is only for link tags that changes color when you put the cursor on it.. But here, I created an animation that changes color of your tag...
Edit : also I forgot to remove your comment
+ 2
JTLZ i know this but if my p tag is not inside the div tag then how i can do this.
+ 2
JTLZ it worked.
+ 2
Jaydeep Khatri thanks what is the use of + is here.
+ 2
WhyFry looks like a computer bot.😅🤣🤣
I'm just kidding.
JTLZ [#NeverGiveUp!] He just kidding i think.
0
put your text in div and set color in hover blue
0
It' good and easy
0
past your text in the div#x element and asign the color you want in your style sheet! in your code you have pasted the text in a paragraph who doesn't have id x, this is the reason why your code doesn't work!