简体   繁体   English

如何对齐此边框?

[英]How do I align this border?

This is what I have so far: http://jsfiddle.net/u8GHJ/ 这是我到目前为止: http//jsfiddle.net/u8GHJ/

What I'm trying to do is attach the black border to the left side of the blue box. 我要做的是将黑色边框贴在蓝色框的左侧。 What is an easy way to achieve this? 实现这一目标的简单方法是什么? And no, I can't just add border-left:4px solid black; 不,我不能只添加border-left:4px solid black; to #container li . #container li

It should look like this: http://i.stack.imgur.com/oLBK8.png 它应该如下所示: http//i.stack.imgur.com/oLBK8.png

Edit: I need to move the border to the container and not the opposite, so setting the padding to 0 won't help in this case. 编辑:我需要将边框移动到容器而不是相反,所以在这种情况下将padding设置为0将无济于事。

There's default padding on the ul element. ul元素上有默认的填充。 To remove it, add ul {padding:0;} ( or #container {padding:0;} ) to your css and every thing will look peachy. 要删除它,请将ul {padding:0;} (或#container {padding:0;} )添加到您的CSS中,并且每个东西都会看起来像桃子。

Check out your updated example here: 在这里查看您的更新示例:

http://jsfiddle.net/agconti/u8GHJ/1/ http://jsfiddle.net/agconti/u8GHJ/1/

ul have default padding Give this a try to resolve your problem: ul有默认padding尝试解决您的问题:

#container{
    padding:0;
}

JS Fiddle JS小提琴

I have solved your problem. 我已经解决了你的问题。 Just add css property of ul 只需添加ul的css属性即可

ul{
    padding:0px;
  }

Click here for DEMO 点击这里进行演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM