定位以及 边框位置的调整
2018-06-19 17:11 麋鹿不卤 阅读(1807) 评论(0) 编辑 收藏 举报定位:
position: absolute; 为绝对定位,绝对定位的元素的位置相对于最近的已定位父元素,如果元素没有已定位的父元素,那么它的位置相对于<html>:
content: "";
position: absolute;
bottom: 50%;
left: 100%;
margin-bottom: -5px;
border-width: 5px;
border-style: solid;
border-color: transparent transparent transparent black;
content: "";
这个元素是空值,目的是使它的边框border为四个三角形。(该空值元素由边框形成的正方形的边长为10px)
position: absolute;
bottom: 50%;
left: 100%;
绝对定位,相对于它的父元素,在父元素右边从下往上中轴线的位置开始画这个元素。即边框的下边沿在父元素的中轴线,
position: absolute;
top: 50%;
left: 100%;
绝对定位,相对于它的父元素,在父元素右边从上往下中轴线的位置开始画这个元素。即边框的上边沿在父元素的中轴线,
margin-bottom: -5px;
border-width: 5px;
用margin-bottom: -5px;来控制边框以内的内容相对于自己的位置(类似于相对定位),使其中轴线和父元素的中中轴线重合。(该空值元素由边框形成的正方形的边长为10px)