Element centered with position:absolute plus zero padding
I have an a-element that I'm centering in a bootstrap column with this...
position: absolute;
margin: auto;
left: 0;
right: 0;
It centers correctly, but the bootstrap column takes up half the page and because I've had to use "left: 0" and "right:0", the a-element also takes up half the page (even though the text it contains is very small). This is frustrating because the user can hover nowhere near the text itself and it will highlight like it's being hovered over.
I've experimented with "display:inline-block !important", "padding:0px !important", and "margin:0px !important", but none of them work while I have the left/right attributes in there (but of course as soon as I remove left/right the absolute positioning centering stops working).
Really appreciate any ideas about how to properly combine an absolute positioning effect without having oversized elements - thanks!
链接地址: http://www.djcxy.com/p/63038.html上一篇: 子元素溢出隐藏在具有溢出的父级:隐藏
下一篇: 以位置为中心的元素:绝对加零填充