gpt4 book ai didi

css - 将元素绝对定位在固定位置的父元素中

转载 作者:行者123 更新时间:2023-11-28 18:19:53 26 4
gpt4 key购买 nike

我有一个与其父 div 固定的 div,在那个固定的 div 中我试图绝对定位图像,但该图像的 css 根本没有做任何事情。图像以其自然位置显示,我无法移动它!

html

<div class="wrapper">
<div class="poster">
<div class="posterfixed">
<div class='18logo'>
<img src='../images/siteimages/18logo.png' />
</div>
<div>
</div>
</div>

CSS

.wrapper{
width:1280px;
position:relative;
border-left:1px solid #ffffff;
border-right:1px solid #ffffff;
margin: 0 auto 0 auto;
background:#000000;
overflow:hidden;
}
.poster{
float:left;
margin:-890px 0 0 890px;
width:390px;
min-height:512px;
}

.posterfixed{
position:fixed;
width:390px;
min-height:512px;
background-image:url(../images/siteimages/background.png);
}

.18logo{
position:absolute;
right:10px;
top:360px;
}

感谢您的关注......................

最佳答案

你的类名应该以字母而不是数字开始,就像你在 .18logo 中那样 - 因为你不能以数字或连字符后跟数字开始类名在 CSS 中。

来自2.1 Spec, Syntax and Basic Data Types:

In CSS, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [a-z0-9] and ISO 10646 characters U+00A1 and higher, plus the hyphen (-) and the underscore (_); they cannot start with a digit, or a hyphen followed by a digit. Identifiers can also contain escaped characters and any ISO 10646 character as a numeric code (see next item). For instance, the identifier "B&W?" may be written as "B\&W\?" or "B\26 W\3F".

关于css - 将元素绝对定位在固定位置的父元素中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17200013/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com