我正在尝试 float 菜单栏中的最后一项 like here回到我的 wordpress,但我无法让它工作。有没有一种实用的方法来做到这一点?
li:nth-last-child(1) {
float: none;
display: inline-block;
}
最佳答案
就在我的脑海中,我会尝试绝对定位。
li:nth-last-child(1) {
position: absolute;
top:0;
right:0;
display: inline-block;
}
你可能会发现 absolute 会打断文档的顺序,所以实际上,给你的左上角和左边一些填充,或者如果你像我一样懒惰......我做到了:
li:nth-last-child(1) {
position: absolute;
top:0.5em;
right:0.5em;
display: inline-block;
}
关于html - 向右浮动菜单栏的最后一项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41855786/