💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
>相对定位 - 1相对定位是相对自己的原本的位置定位 position:relative; >绝对定位 - 2在父级的基础上的绝对的位置(与其给了定位的离得最近的父级) position:absolutive; - 3div悬浮在屏幕上 position:fixed; - 4搜索框格式 <div class="search"> <input> <button></button> </div> - 5 定位垂直居中 ![1.png](https://upload-images.jianshu.io/upload_images/13085823-6d076e38b6d1603f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ~~~ .parent{ position: relative; width:300px; height:300px; background:red; } .child{ position:absolute; width:50px; height:50px; background:green; left:50%;子元素left,top值给百分比,是相对于父元素的width,height而言的 top:50%; margin-left:-25px;(height的一半) margin-top: -25px; } ~~~ - 6弧度 border-radius - 7堆叠顺序 z-index 设置给了absolute定位元素的堆叠顺序 数字越大,顺序越前,越先显示 - 8设置盒子尺寸 div{box-sizing: border-box;}