Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的目标是使绝对元素居中。喜欢calc(50% - 123px),但在 jQuery 的帮助下。它的正确语法是什么?
calc(50% - 123px)
element.css({ width: pageWidth, left: '50%' - pageWidth / 2 })
我敢打赌就是这个
element.css({ width: pageWidth, left: '50%', margin-left: - pageWidth / 2 })