我有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%;
}
也可以在這裏:http://jsfiddle.net/FranLegon/y7so6u10/
這是我的建議爲好。更新小提琴在這裏https://jsfiddle.net/fqzmn5rd/2/ – 2015-02-11 18:39:17
@AnthonyTJRivas非常感謝!但現在'img's有一個空白區域(看起來像一個邊緣,但它不是)我不能擺脫。任何想法爲什麼發生這種情況 – FranLegon 2015-02-12 14:26:03
嗯。不知道你可以發表小提琴嗎? – cangoektas 2015-02-13 22:35:40