<style> .container{ position: relative; border: 1px solid #000011; top: 100px; height: 500px; width: 500px; } #cm{ position: absolute; border: 1px solid red; margin: auto auto; } .hc{ width: 200px; left: 0; right: 0; } .vc{ height: 40px; top: 0; bottom: 0; } </style> </head> <body> <div class="container"> <p id="cm" class="hc vc"></p> </div>
css 设计模式 absolute 居中对齐
最新推荐文章于 2024-04-02 14:52:40 发布
本文深入探讨了CSS中absolute定位的应用与布局技巧,通过实例展示了如何利用absolute定位实现复杂布局,包括绝对元素的定位原则、自适应布局及响应式设计的实践。
857

被折叠的 条评论
为什么被折叠?



