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.
我里面有DIV和UL,位置:绝对。默认情况下,左侧为 0px。我需要将 UL 移动到 100% 的 UL 宽度的左侧。UL 右角将是 DIV 左角开始的位置。
如果您知道 ul 的宽度,请将 left 属性设置为 -that 宽度,例如
left: -100px;
您是否尝试过为 UL 赋予样式:
ul { margin-left:-100%; }
这应该将其移动到与 UL 相同的宽度,并将呈现在 div 之外。如果没有更多页面源,很难说这将如何影响您的布局的其余部分......
编辑:
要使 UL 相对于 DIV 移动,还需要设置:
div { position:relative; }