div内li标签间距_ul 内li 间距问题

我准备实现一个3D导航栏,ul 里的li 存在默认间距,使用margin-right后,chrome和edge出现偏差,这应该是浏览器默认的样式,这里又不存在什么外边距合并的问题,只能换另外一种思路解决,好多人说用 *{margin:0; padding:0;},要是能解决,我就不在这问了,求救大神,chrome里设定margin-right:-9px; edge 里设定 margin-right: -4px; 如何不通过这种方式,实现这两个浏览器的兼容。代码如下:

样式

ol,ul,li {list-style: none; text-decoration: none;}

body {background-color: #bebebe;}

#three {width:660px; padding: 0 20px; margin: 20px auto; background-color: #f65f57; box-shadow: 0px 7px 5px #ba4a45; border-radius: 8px; text-align: center; }

#three li{position: relative; padding: 10px 20px; display: inline-block; list-style: none outside none; margin:0; }

#three a{display: inline-block; text-decoration: none; font: bold 20px/1 Arial; color: #fff; text-shadow:1px 2px 4px rgba(0,0,0,.5);}

#three li::after {content:""; position: absolute; top: 8px; width: 1px; height: 24px; background: linear-gradient(to top, #ff625a, #9e3e3a 50%, #ff625a);}

#three li::after {right: 0;}

#three li:last-child::after {display: none;}

/*动效*/

#three a:hover {transform: rotate(10deg); -webkit-transform: rotate(10deg);}

#three a {transition: all .2s ease-in ;}

96b915915604abaa008e52dd793c1222.png

c5b4243f113ecc2dcd767bb1cf57dcea.png

d6757243ec574b6c047bb5ffe82ba486.png

74254385591c8555168083e8a67afbfc.png

有一种兼容的办法是,不使用::before 伪类,只使用::after伪类

ol,ul,li {list-style: none; text-decoration: none;}

body {background-color: #bebebe;}

#three {width:660px; padding: 0 20px; margin: 20px auto; background-color: #f65f57; box-shadow: 0px 7px 5px #ba4a45; border-radius: 8px; text-align: center; }

#three li{position: relative; padding: 10px 20px;

display: inline-block; list-style:

none outside none; }

#three a{display: inline-block; text-decoration: none; font: bold 20px/1 Arial; color: #fff; text-shadow:1px 2px 4px rgba(0,0,0,.5);}

#three li::after {content:""; position: absolute; top: 8px; width: 1px; height: 24px; background: linear-gradient(to top, #ff625a, #9e3e3a 50%, #ff625a);}

#three li::after {right: 0;}

#three li:last-child::after {display: none;}

/*动效*/

#three a:hover {transform: rotate(10deg); -webkit-transform: rotate(10deg);}

#three a {transition: all .2s ease-in ;}

虽然能解决,但是两个li的间距还是存在???????????????

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值