html - 当我在 CSS 中定义较小的尺寸时,标题中的 Logo 图像的尺寸不会改变

标签 html css

Website Screenshot : 我的 Logo 图像默认为 264x84px。它位于 69 像素高的标题中,高度已定义为 50 像素,但 Logo 不会改变大小。它比标题大

我尝试过设置 max-height 并进行修改,然后将其设置得更小,看看是否有帮助,但它根本不会调整大小

///html///

<div class='heading'>
        <a class='logo' href="../index.html"><img src="img-tea-cozy-logo.png"></a>

///html///

///css///

.logo {
    height: 50px;
    float: left;
}

.heading {
    position: fixed;
    width: 100%;
    top: 0;
    border-bottom: 1px solid seashell;
    height: 69px;
}

///css///

我不明白为什么图像保持相同的大小

最佳答案

您需要直接设置图像的高度或在其上设置对象适合。 当前图像扩展到父元素边框的方式。

关于html - 当我在 CSS 中定义较小的尺寸时,标题中的 Logo 图像的尺寸不会改变,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55581332/

相关文章:

css - 使自定义复选框不改变它的大小。

html - 将文本和图像排列在同一行

javascript - 保存具有 id 的元素的变量存储在哪里?

html - Bootstrap 垂直对齐按钮但不是响应内容

javascript - 响应式设计 - 饼图

asp.net - 奇怪的 CSS 行为

html - 未设置溢出时 Div 高度不正确

html - 使列表项彼此相邻

css - 我无法在主要区域设置 padding-right

css - CSS 引用的 Flex 3 SWC Assets