如何上移所有元素'通过操纵顶值

How to move up all elements' by manipulating top value?

本文关键字:操纵 元素      更新时间:2023-09-26

我下载了一个ios锁屏,其中有多个元素显示有关天气的事实,即文本,小图像…无论如何,我想知道如何将它们全部移动到屏幕的顶部,目前它们在中间。每个元素都有绝对位置和不同的z索引。我应该改变top:值吗?我是否应该对它们进行分组,如果是的话,我该如何做到这一点并将它们全部向上移动?顺便说一下,锁屏主题中允许使用所有js, html, css

UPDATE这是代码!-

<style type="text/css">
.weekday
{
position: absolute;
top: 252px;
left: -18px;
width: 320px;
height: 60px;
text-align:right;
font-family:source_sans_prolight;
font-weight:100;
font-size: 13px;
color: white;
text-transform:lowercase;
}
</style>

<style type="text/css" >
.month{
position: absolute;
top: 268px;
width: 320px;
left: -33px;
height: 60px;
text-align:right;
font-family:source_sans_prolight;
font-weight:100;
font-size: 13px;
color: white;
text-transform:lowercase;
}
</style>
<style type= "text/css">
.date{
position: absolute;
top: 268px;
width: 320px;
left: -18px;
text-align:right;
font-family:source_sans_prolight;
font-weight:100; font-size:
13px;
color: white;
}
</style>
<style type="text/css">
.icon{
position: absolute;
z-index:10;
left: 15px;
top: 200px;
}
</style>
<style type="text/css">
#temp{
position:absolute;
z-index:7;
color:white;
top: 251px;
left:40px;
width: 320px;
font-size:15px;
font-weight:200;
font-family: source_sans_prolight;
}
</style>
<style type="text/css">
#clock{
position:absolute;
width: 320px;
height: 200px;
left: -15px;
text-align: right;
z-index: +4;
top: 194px;
font-family: source_sans_prolight;
color:white;
font-size: 55px;
font-weight: 100;
}
</style>

还有更多,但这就是它看起来的样子!

非常困难,没有你张贴任何代码!为了回答你关于如何将它们移动到顶部的问题,我会在其他元素周围添加一个容器<div>元素,然后将其CSS设置为:

.lock-item-container {
    position: absolute;
    top: 0;
}

您可能需要根据子元素的位置设置宽度。希望这能有所帮助,如果没有,请添加一些您的标记&div CSS。