When I set
@media screen and (max-width: 700px)
, aside {width: 0}
, it doesn't disappear. Even after resizing the window, it remains as null space with width: 52px
. What could be causing this issue and how can I resolve it?
* {
margin:0;
padding:0;
}
html, body {
height: 100%;
}
body {
background-color: #eee;
}
.wrapper {
height: 100%;
display: table;
width: 100%;
text-align: center;
border-collapse: collapse;
}
header {
box-sizing: border-box;
display: table-row;
height: 50px;
background-color: #eee;
border-bottom: 1px solid black;
}
main {
height: 100%;
display: table;
width: 800px;
margin: 0 auto;
background-color: #fff;
}
section {
display: table-cell;
}
aside {
display: table-cell;
box-sizing: border-box;
border-left: 1px solid black;
width: 300px;
/*__transition*/
opacity: 1;
transition: all .25s;
}
footer {
box-sizing: border-box;
border-top: 1px solid black;
display: table-row;
height: 50px;
background-color: #eee;
}
@media screen and (max-width: 800px) {
main {
width: 100%;
}
}
@media screen and (max-width: 700px) {
section {
width: 100%;
}
aside {
opacity: 0;
width: 0;
}
}
<html>
<body>
<div class="wrapper">
<header>HEADER</header>
<main>
<section>SECTION</section>
<aside>ASIDE</aside>
</main>
<footer>FOOTER</footer>
</div>
</body>
</html>