【发布时间】:2015-02-12 02:10:03
【问题描述】:
我有 3 个a 和width:100%。我不想设置高度以使图像保持比例。由于某些未知原因,如果未指定高度或将高度设置为自动,a 元素就会消失。知道为什么会这样吗?
HTML:
<div class="cuerpo">
<div class="articulosysidebar">
<!--articulos-->
<div class="articulos"></div>
<!--sidebar-->
<div class="sidebar"></div>
</div>
<!--botones redes sociales-->
<div class="social">
<a class="twitter" href="https://twitter.com/franlegon"></a>
<a class="facebook" href="https://www.facebook.com/franlegon"></a>
<a class="pinterest" href="http://www.pinterest.com/franlegon/"></a>
</div>
</div>
CSS:
body{height:2000px}
/**/
.social {
height:100%;
width: 4.7%;
}
.social a {
height: 3vw; /*HERE I WANT NOTHING*/
width: 100%; /*HERE I WANT 100%*/
float:right;
display: block;
}
.twitter {background-image: url(http://ow.ly/IPVSe);}
.facebook {background-image: url(http://ow.ly/IPVWg);}
.pinterest {background-image: url(http://ow.ly/IPVGB);}
/**/
.cuerpo {
width:100%;
height:100%
}
.articulosysidebar {
width:91%;
height:100%;
background:#DEDEEC;
margin-right:4%;
float:right;
}
/**/
.articulos {
width: 74%;
height:100%;
float: left;
}
/**/
.sidebar {
background: #165eac;
float:right;
width: 25%;
height:100%;
}
【问题讨论】: