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.
我想在网站的右侧有一行文字。
body 的宽度设置为 100%,body 的 margin-left 也为 20px。
如果我现在将宽度设置为继承并将文本对齐设置为“右”。文本行略微超出右侧浏览器边框。因为也传递了 20px 的边距。
因为我不能把 widht= inherit - 20px 或继承 - margin-left(ofbody)
解决这个问题的最优雅的方法是什么?
一如既往地再次感谢!
Try position:absolute with left:0px; right -20px;.
position:absolute
left:0px; right -20px;
(This is what I gather your problem is, although some example HTML and CSS would make your question clearer.)