button hide

¹öÆ° Hover »óÅÂÀ϶§ ´Ù¸¥ ¹öÆ°À» Show/Hide ½ÃÄѺ¸ÀÚ.

1. #a ¹öÆ° Hover »óÅÂÀ϶§, #c ¹öÆ°À» º¸¿©ÁØ´Ù.

#a:hover ~ #c {
    display: inline-block;
}

~ ¼±ÅÃÀÚ´Â ÀÏ¹Ý ÇüÁ¦ ¼±ÅÃÀÚ·Î ~ µÚ¿¡ ÀÖ´Â ¿ä¼ÒµéÀ» ¸ðµÎ ¼±ÅÃÇÑ´Ù.
+ ¼±ÅÃÀÚ´Â ÀÎÁ¢ ÇüÁ¦ ¼±ÅÃÀÚ·Î + µÚ¿¡ ÀÖ´Â ¿ä¼Ò°¡ ¾Õ¿¡ ÀÖ´Â ¿ä¼Ò¿¡ ÀÎÁ¢ÇÑ °æ¿ì¿¡¸¸ À¯È¿ÇÏ´Ù.

 A ¿ä¼Ò +  B ¿ä¼Ò

ÁÖÀÇÇÒ°ÍÀº html body¿¡¼­ A¿ä¼Ò°¡ ¸ÕÀú ¿Í¾ß Á¤»óÀûÀ¸·Î ½ÇÇàµÈ´Ù.

<button class="button" id="a">Button1</button>
<button class="button" id="b">Button2</button>


<!DOCTYPE html>
<html>
<head>
<style>
.button {
    background-color: #4CAF50;
    border: none;
    color: white;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
}


#b , #c {
    display: none;
}


#a:hover ~ #c {
    display: inline-block;
}

</style>
</head>
<body>

<button>Default Button</button>
<button class="button" id="a">Button1</button>
<button class="button" id="b">Button2</button>
<button class="button" id="c">Button3</button>

</body>
</html>

½ÇÇà:




2. #a ¹öÆ° Hover »óÅÂÀ϶§, .x-group ¹öÆ°À» º¸¿©ÁØ´Ù.

<!DOCTYPE html>
<html>
<head>
<style>
.button {
    background-color: #4CAF50;
    border: none;
    color: white;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
}

.x-group {
    background-color: #4CAF50;
    border: none;
    color: white;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
}

.x-group {
    display: none;
}

#x:hover ~ .x-group {
    display: inline-block;
}

</style>
</head>
<body>

<button>Default Button</button>
<button class="button" id="x">Button1</button>
<button class="x-group" id="y">Button2</button>
<button class="x-group" id="z">Button3</button>

</body>
</html>

½ÇÇà:



ÂüÁ¶)
¼±ÅÃÀÚ:
http://poiemaweb.com/css3-selector
http://www.clearboth.org/css3_1_by_isdn386/