Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make :hover inside div style? [duplicate]

Tags:

html

css

hover

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 it somehow doesn't work at the inline CSS, this is the only thing I can get it done. If you got a solution for that, I'd be greatful. But so, I want to make the :hover property but how because this won't 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;}
like image 572
Yesse Engold Avatar asked Jan 13 '23 13:01

Yesse Engold


1 Answers

You can't have pseudo selectors within inline styles.

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

like image 139
zzzzBov Avatar answered Jan 16 '23 01:01

zzzzBov