css样式实现:搜索框的样式为平行四边形

 效果图:

 代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>平行四边形搜索框</title>
    <style>
        * {
            margin: 0px;
            padding: 0px;
            box-sizing: border-box;
        }
        body {
            background: url(/images/qionghai.png) no-repeat;
            background-size: 100%;
        }
        .input-group {
            margin:160px 1050px;
            width: 500px;
        }
        .input-group-ipt {
            position: relative; /*关键 */
            display: inline-block;
            padding: 2px 0;
            width: 300px;
            text-align: center;
        }
        .input-group-ipt::before {
            content: '';
            position: absolute; /*关键 */
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            z-index: -1; /*若效果不显示,就在第一个relative属性加上一个更高的层级(z-index:1)*/
            border:1px solid #FF6600;
            border-top-left-radius: 10px;
            border-bottom-left-radius: 4px;
            transform: skew(23deg); /*旋转的角度 */
            background-color: rgba(255, 255, 255, 0.7);
            box-shadow: 0 0 10px rgb(52 152 68 / 35%);
        }
        .ipt {
            width: 290px;
            height: 39px;
            border: 0px; /*去除input边框 */
            outline: none; /*去除当点击input框时显示的边框 */
            padding: 0px 10px;
            background: transparent; /*背景色为透明色 */
            color: #555;
        }
        .btn {
            position: absolute; /*关键 */
            padding: 8px 11px 9px 10px;
            width:50px;
            height:43px;
            border: 0px;
            outline: none;
            box-shadow: none!important; 
            transform: skewX(23deg);
            background-image: linear-gradient(to top, #FF6600 0%, #FF6600 100%);
            border-bottom-right-radius: 10px;
            cursor: pointer;
        }
    </style>
</head>
<body>
    <div class="input-group">
        <form action="" target="_blank" method="post">
            <div class="input-group-ipt">
                <input class="ipt" type="text" placeholder="请输入内容"/>
            </div>
            <span class="input-group-btn">
                <button class="btn" type="submit">
                    <img src="/images/20211202112638676.png" style="transform: skewX(-23deg);" alt="">
                </button>
            </span>
        </form>
    </div>
</body>
</html>

【用css实现带边框的平行四边形效果】

   参考:css样式实现:带边框的平行四边形_zuo-yiran的博客-CSDN博客_css边框平行四边形

【z-index属性无效时的解决办法】

  参考:div层调整z-index属性无效原因分析及解决方法_乌云大帝的博客-CSDN博客_div z-index 无效

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值