<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>斜切的导航</title>
<style>
*{margin: 0;padding: 0;overflow: hidden;}
ul{list-style: none;}
ul{width: 440px;margin: 30px auto;}
ul li{float: left;width: 100px;height: 30px;background: red;color: white;line-height: 30px;text-align: center;margin: 0 5px;transform: skew(-30deg);}
ul li span{transform: skew(30deg);display: block;}
ul li:first-child{padding-left: 10px;margin-left: -10px;}
ul li:last-child{padding-right: 20px;margin-right: -20px;}
</style>
</head>
<body>
<div>
<ul>
<li><span>首页</span></li>
<li><span>歌谣</span></li>
<li><span>商品</span></li>
<li><span>午睡</span></li>
</ul>
</div>
</body>
</html>
运行结果
来源:CSDN
作者:你知道歌谣吗?
链接:https://blog.csdn.net/weixin_43392489/article/details/103648856