相对定位relative
相对定位的参考物是元素的初使位置
相对定位的特点:
不影响元素本身的特性
元素不脱离文档流
相对于原位置进行偏移
div{
width: 100px;
height: 100px;
margin: 10px;
font-size: 40px;
text-align: center;
line-height: 100px;
background-color: orange;
}
div:nth-of-type(2){
position: relative;
left: 100px;
}
<div>1</div>
<div>2</div>
<div>3</div>