I want to position a (or a ) element at the center of the screen irrespective of screen size. In other words, the space le 13条回答 旧巷少年郎 (楼主) 2020-11-28 18:59 It will work for any object. Even if you don't know the size: .centered { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); } 0 讨论(0) 查看其它13个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复 热议问题
(or a ) element at the center of the screen irrespective of screen size. In other words, the space le 13条回答 旧巷少年郎 (楼主) 2020-11-28 18:59 It will work for any object. Even if you don't know the size: .centered { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); } 0 讨论(0) 查看其它13个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复 热议问题
) element at the center of the screen irrespective of screen size. In other words, the space le 13条回答 旧巷少年郎 (楼主) 2020-11-28 18:59 It will work for any object. Even if you don't know the size: .centered { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); } 0 讨论(0) 查看其它13个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复 热议问题
It will work for any object. Even if you don't know the size:
.centered { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); }