CSS 定位问题:属性 值无效
CSS positioning issues: invalid property value
我有一些非常简单的 HTML/CSS 代码,无论我做什么,我总是得到 chrome 的“无效 属性 值”异常,并且徽标不会t位置合适
修复了第一个问题,但现在图像不会移动与边框相关的问题。
<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>
在 padding-bottom:50 px;
中的 px
之前有一个 space。修正:
padding-bottom: 50px;
我只是不明白你为什么在这种情况下使用 padding-bottom 而不是 bottom。总之:
<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 {
position: relative;
height: 100px;
border-bottom: 5px solid rgb(220,30,60);
}
.logo {
position: absolute;
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>
CSS 底部 属性: http://www.w3schools.com/cssref/pr_pos_bottom.asp
CSS 填充底部 属性: http://www.w3schools.com/cssref/pr_padding-bottom.asp
我遇到了类似的问题。
我写了 10
(而不是 10px
),这解决了问题。
如果您在 css 中使用单引号,请从您的 css 文件中删除单引号。
例如
// Wrong
.row{
margin-left:'-16px !important';
margin-right:'0px !important';
}
// Right
.row{
margin-left:-16px !important;
margin-right:0px !important;
}
我有一些非常简单的 HTML/CSS 代码,无论我做什么,我总是得到 chrome 的“无效 属性 值”异常,并且徽标不会t位置合适
修复了第一个问题,但现在图像不会移动与边框相关的问题。
<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>
在 padding-bottom:50 px;
中的 px
之前有一个 space。修正:
padding-bottom: 50px;
我只是不明白你为什么在这种情况下使用 padding-bottom 而不是 bottom。总之:
<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 {
position: relative;
height: 100px;
border-bottom: 5px solid rgb(220,30,60);
}
.logo {
position: absolute;
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>
CSS 底部 属性: http://www.w3schools.com/cssref/pr_pos_bottom.asp
CSS 填充底部 属性: http://www.w3schools.com/cssref/pr_padding-bottom.asp
我遇到了类似的问题。
我写了 10
(而不是 10px
),这解决了问题。
如果您在 css 中使用单引号,请从您的 css 文件中删除单引号。
例如
// Wrong
.row{
margin-left:'-16px !important';
margin-right:'0px !important';
}
// Right
.row{
margin-left:-16px !important;
margin-right:0px !important;
}