<html> <head> <style> /* 普段の子要素はnone */ DIV.target > DIV { display:none; } /* hoverされた時の子要素はblock */ DIV.target:hover > DIV { display:block; } </style> </head> <body> <div class="target"> 親要素 <div> 子要素 </div> </div> </body> </html>

<html> <head> <style> /* 普段の子要素はnone */ DIV.target > DIV { display:none; } /* hoverされた時の子要素はblock */ DIV.target:hover > DIV { display:block; } /* 普段の親要素は頭に"+" */ DIV.target:before { content:"+"; } /* hoverされた時の親要素は頭に"-" */ DIV.target:hover:before { content:"-"; } </style> </head> <body> <div class="target"> 親要素 <div>子要素</div> </div> </body> </html>
