简体   繁体   English

我可以使用Tachyons将img标签的高度设置在其父标签中吗?

[英]Can I fit an img tag's height inside its parent using Tachyons?

I would like to create a banner that features a logo inside it however my image seems to ignore the height of its parent. 我想创建一个横幅,其中带有徽标,但是我的图像似乎忽略了其父级的高度。 Check out this JSFiddle for an example of what I'm trying to achieve. 查看此JSFiddle ,以获取我要实现的示例。

I can get the layout I want by adding height: 100% to the img tag however I'd like to use tachyons to do so and there doesn't seem to be a tachyons class for height 100%. 我可以通过将height: 100%添加到img标签来获得所需的布局,但是我想使用tachyons来做到这一点,并且似乎没有tachyons类用于高度100%。 Is there another way to fit the img using tachyons or am I forced to create a class with height: 100% ? 是否有另一种方法可以使用tachyons来适应img,还是我被迫创建一个height: 100%

Yes, you want class="h-100" ! 是的,您要class="h-100"

tachyons.io Heights docs tachyons.io Heights docs

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM