我有一些非常简单的 HTML/CSS 代码,无论我做什么,我总是会收到 chrome 的“无效属性值”异常,并且徽标无法正确定位。
修复了第一个问题,但现在图像不移动与边框相关。
<html lang="de" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>my website</title>
<style type="text/css">
*{ padding: 0; margin: 0; }
.header {
width: 100%;
height: 100px;
border: none;
border-bottom-style: solid;
border-bottom-width: 5px;
position: relative;
border-bottom-color: rgb(220,30,60);
}
.logo {
position: absolute;
padding-bottom:50px;
height: 150%;
width: auto;
}
</style>
</head>
<body>
<div class="header" id="header">
<img id="logo" class="logo" src="image.png"/>
</div>
</body>
</html>
原文由 tagduck 发布,翻译遵循 CC BY-SA 4.0 许可协议
我只是不明白为什么在这种情况下你使用 padding-bottom 而不是 bottom 。反正:
CSS 底部 属性: http ://www.w3schools.com/cssref/pr_pos_bottom.asp
CSS padding-bottom 属性: http ://www.w3schools.com/cssref/pr_padding-bottom.asp