レスポンシブ Web サイトで作業していて、特定の要素を削除したいのですが、子要素は引き続き表示したいです。
親要素の CSS ルールを display:none; に設定します。その要素とすべての子を削除します。子要素を display:block; に設定した場合のイベント。まだサイトに表示されません。
このようなもの:
HTML:
<div id="parent">
<div id="child">Some text.</div>
</div>
CSS:
#parent {
display:block;
width:500px;
height:200px;
background:blue;
}
#child {
display: inline-block;
padding:20px 5px;
background: red url(someimage.jpg);
}
@media only screen
and (max-device-width : 700px) {
#parent {
/* code that makes the browser disregard the height of this div and not display its background */
}
#child
/* the child is still displayed */
}
}
適切な CSS ソリューションは何でしょうか?