标签与其中的标签大小不同( tag is not at the same size of tag inside it)

编程入门 行业动态 更新时间:2024-10-28 13:15:21
标签与其中的标签大小不同( tag is not at the same size of tag inside it)

我有以下基本的HTML内容:

<div> <a href="..."> <img src="..." width="81" height="75" ... /> </a> </div>

事实上,“A”标签的高度仅为19px,而图像元素的高度设置为75px。

即使我手动将“A”标签的高度设置为75px,它也不会被设置并保持不变。

围绕“A”标签的“DIV”元素获取“IMG”元素的确切尺寸,无需手动或任何地方设置。

浏览器是Chrome,最新版本。

如何正确设置“A”标签的高度,因此它总是覆盖(自动)整个“IMG”元素?

I have the following basic HTML content:

<div> <a href="..."> <img src="..." width="81" height="75" ... /> </a> </div>

De-facto, the height of the "A" tag is only 19px, while the image element is set to 75px.

Even when I set the height of the "A" tag manually to 75px, it doesn't get set and stays as is.

The "DIV" element surrounding the "A" tag gets the exact dimensions of the "IMG" element, without setting it manually or anywhere.

The browser is Chrome, latest version.

How do I set the height of the "A" tag correctly, so it always covers (automatically) the entire "IMG" element??

最满意答案

尝试将display:inline-block添加到<a>元素。

Try adding display:inline-block to the <a> element.

更多推荐

IMG,元素,标签,px,电脑培训,计算机培训,IT培训"/> <meta name="description"

本文发布于:2023-08-01 18:58:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1363817.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:标签   大小   size   tag

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!