How to assign display properties to div 2?

I want to assign display properties to div 2, I'm not sure if the correct syntax is ...

#div2 { display:none;inline-block; } 

What is the right way to do this?

UPDATE:

 #div2 { display:none; } $(function() { $("#div1").mouseover(function() { $("#div2").css('display', 'inline-block'); }).mouseout(function(){ $("#div2").css('display', 'none'); }); }); 
+4
source share
2 answers

You can set only one value at a time in the display property. In this case, display: none will cause the div to not be displayed at all, so inline-block is completely irrelevant here.

I assume that you want to somehow switch the visibility using javascript. To do this, switch the display property between none and inline-block . As I said, you can always have only one value.

+5
source

You just can't do it like Sotiris . Just like you cannot set two different background colors.

Try using jQuery (or native js) for this.

http://api.jquery.com/mouseover/

http://api.jquery.com/addClass/

0
source

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


All Articles