Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何使用css移动对象_Html_Css_Header - Fatal编程技术网

Html 如何使用css移动对象

Html 如何使用css移动对象,html,css,header,Html,Css,Header,请帮我移动上面的物体。我使用了页边空白,但没有工作 CSS HTML 将父类添加到容器元素中,将子类添加到要进一步向上移动的元素中 .parent{ position:relative; } .child{ position:absolute; top: -10px; } 您使用的是top而不是margintop 添加页边空白 section#features .center-box{ display:block; background-color:#22a3

请帮我移动上面的物体。我使用了页边空白,但没有工作

CSS

HTML



将父类添加到容器元素中,将子类添加到要进一步向上移动的元素中

.parent{
  position:relative;
}

.child{
  position:absolute;
  top: -10px;
}

您使用的是
top
而不是
margintop

添加页边空白

section#features .center-box{
    display:block;
    background-color:#22a3df;
    transform: rotate(45deg);
    padding:10px;
    width:40px;
    height:40px;
    margin: 13px auto 0;
}

首先给出您的div位置,然后使用top进行定位:

.center-box{
display:block;
background-color:#22a3df;
transform: rotate(45deg);
padding:10px;
width:40px;
height:40px;
margin: 0 auto;
position:Relative;
top:13px;}

你能添加你的代码或演示以便更好地理解吗
section#features .center-box{
    display:block;
    background-color:#22a3df;
    transform: rotate(45deg);
    padding:10px;
    width:40px;
    height:40px;
    margin: 13px auto 0;
}
.center-box{
display:block;
background-color:#22a3df;
transform: rotate(45deg);
padding:10px;
width:40px;
height:40px;
margin: 0 auto;
position:Relative;
top:13px;}