繁体   English   中英

CSS 定位问题:无效的属性值

[英]CSS positioning issues: invalid property value

我有一些非常简单的 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>

我有一个类似的问题。

我写了10 (而不是10px ),这解决了这个问题。

我只是不明白你为什么在这种情况下使用padding-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 padding-bottom属性: http : //www.w3schools.com/cssref/pr_padding-bottom.asp

如果您在 css 中使用单引号,请从 css 文件中删除单引号。

例如

// Wrong
.row{
    margin-left:'-16px !important';
    margin-right:'0px !important';
}

// Right
.row{
    margin-left:-16px !important;
    margin-right:0px !important;
}

还有的前一个空间pxpadding-bottom:50 px; . 修复:

padding-bottom: 50px;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM