固定宽度&; 使用“a href”时的高度百分比?
这是我的代码,但是当我使用href到img时,我不能ixed width&; 身高百分比,那么我该怎么做呢?
固定宽度&; 使用“a href”时的高度百分比?
<a href="blog/{{ $blog->id }}"><img src="{{ $blog->image_url }}" class="card-img-top" alt="{{ $blog->title }}" width="90%" height="80%"></a>
这是因为宽度和高度的%
值发生在父容器或可用于父容器的表示区域中。
例:如果你有的话
<div style="width: 1000px;">
<a href="https://a.com">
<img src="https://picsum.photos/200" alt="aa" width="50%" />
</a>
</div>
因此在上述情况下,图像宽度将是500px
,因为1000px的50%
是500px
因此,请确保根据它的父容器或可用的表示区域来指定%
值。