css中两张图片重叠出现黑色边框

html-css09

css中两张图片重叠出现黑色边框,第1张

这是因为右边的图片边框压住了左边的图片边框。

边框值设置的是1px,margin-left:-1,向左移动1px就可以了。

如果盒子都没有加定位,可以鼠标悬浮时,给盒子加上相对定位relative属性。因为相对定位的盒子会压住普通盒子,位置没有设置偏移量的话就不会动。

.wrap li:last-child{ border-right:none} 吧最后一个li的border-right的border去掉。。。但是兼容不好,ie好像是ie9以上的浏览器才行~~

不行还有一种方法li给border,通过margin-left:-1px合并border,具体如下

body,ul{

margin:0

padding:0}

li{

list-style:none}

.wrap{

width:385px

height:39px

overflow:hidden

border-left:1px

solid

#0000f0

margin:30px

auto}

.wrap

li{

width:76px

height:37px

line-height:37px

text-align:center

border:1px

solid

#0000f0

float:left

margin-left:

-1px

}

妙味

妙味

妙味

妙味

妙味

演示: