尝试在列表中的CSS中使用负边距
我花了一个小时尝试让 WordPress 侧边栏中的列表具有负边距。在 php 文件中胡乱使用边距、填充、侧边栏位置......但链接图像只是不断消失在背景后面。
这是我正在工作的页面: http://kirahenschel.com/
这就是我想要实现的目标: http://emgraphics.net/kira/idea2-11.jpg
理想情况下我'我也喜欢侧边栏的高度有限,这样底部的白框就会散开,但我可以应对它们位于右侧的情况。
有人有什么想法吗?徽标上的负边距效果很好,所以它只是一个列表?
谢谢
I have been trying for an hour to get a list in a sidebar of WordPress to have a negative margin. Fooled around with margins, padding, sidebar placement in the php files... But the link images just keep disappearing behind the background.
Here's the page where I'm working: http://kirahenschel.com/
This is what I am trying to achieve:
http://emgraphics.net/kira/idea2-11.jpg
Ideally I'd also like that sidebar to be a finite height so the white boxes on the bottom spread, but I can cope with them being off to the right.
Anyone have any ideas? Neg margins are working fine on the logo, so it is just a list thing?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您只是想让列表向左移动,为什么不使用 CSS 定位属性呢?负边距可能会变得非常不稳定,并且(很可能)在此应用程序中不需要。
您可能还需要更改 div 的位置元素的值,但这会碰撞您的 div 及其中的所有内容,与容器 div 重叠。
如果这不能回答您的问题,您可以发布您正在使用的 HTML 和 CSS 吗? CSS 代码
确实应该在此应用程序中工作,所以请向我们展示您所拥有的内容。
If you're merely trying to get the list to be bumped to the left, why not use a CSS positioning property? Negative margins can get really wonky, and are (most likely) unneeded in this application.
You may also need to change the value of your div's position element, but this will bump your div and everything in it left, overlapping the container div.
If that doesn't answer your question, can you post the HTML and CSS you are using? The CSS code
really should work in this application as well, so show us what you've got.
您的负保证金正在按预期发挥作用。图像被截断的原因是您在
#main
容器上设置了overflow:hidden
。如果删除该属性,您的图像将会出现。Your negative margin is working as expected. The reason the images are getting cut off is because you have set
overflow:hidden
on the#main
container. If you remove that property your images will appear.