style="background: black; width: 90px; height: 80px; color: wh...">

How do I: hover inside a div style?

So my code looks like this:

<div id="blackbox">style="background: black; width: 90px; height: 80px; color: white; text-align: center; font-family: Times; font-size: 20px; position: fixed; left: 0px; bottom: 150px 

Now this somehow doesn't work on inline CSS, this is the only thing I can do. If you have a solution for this, I will be very grateful. But so, I want to create a property: hover, but how it will not work:

 <div style="background: black; width: 90px; height: 80px; color: white; text-align: center; font-family: Times; font-size: 20px; position: fixed; left: 0px; bottom: 150px} blackbox:hover {background: white;} 

or

 :hover {background: white;} 

or

 hover {background: white;} 
+4
source share
4 answers

You cannot have pseudo selectors inside inline styles.

You need to use CSS in the external stylesheet ( <link rel="stylesheet" href="style.css" /> ) or use the <style> element.

+9
source

Built-in pseudo code ! Impossible. Try this in the built-in or external style sheet.

0
source

write in css

 #blackbox:hover { //write something } 
0
source

Pseudo-selectors cannot be used inline. :) You must specify it separately in css.

0
source

Source: https://habr.com/ru/post/1499157/


All Articles