6 个回答

可以用overflow:hidden来实现,背景可以放任意图片


<div class="wrapper">
    <div class="word"><p>ABOUT<span></span></p></div>
</div>
<style>
    .wrapper{
        width: 250px; 
        height: 100px; 
        background: url(http://t2.hddhhn.com/uploads/tu/201610/198/hkgip2b102z.jpg) 57%;
        color: #fff;
    }
    .wrapper .word{
        transform: rotateZ(30deg);
        overflow: hidden;
        width: 107px;
        font-size:35px;
    }
    .wrapper .word p{
        position: relative;
        transform: rotateZ(-30deg);
    }
    .word span{
        position: absolute;
        right: -30px;
        top: 13px;
        height: 36px;
        width: 24px ;
        border-left: 2px solid #fff;
        transform: rotateZ(30deg);
    }
</style>

图片描述

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style>
            .label{width: 400px; height: 100px; background:#007DDB; color: #fff;margin: 100px auto; text-align: center;}
            .label div{display: inline-block; vertical-align: middle;font-size:24px ;}
            .label .let{font-size: 40px;position: relative;}
            .let em{position: absolute;right: 0;height: 100%;width: 24px; background:#007DDB ;border-left: 1px solid #fff; transform-origin: bottom left; transform: rotateZ(32deg);}
            .rgt{position: relative;z-index: 2;}
        </style>
    </head>
    <body>
        <div class="label">
            <div class="let">ABOUT<em></em></div>
            <div class="rgt">走进建业</div>
        </div>
    </body>
</html>

用一个div给一个白色边框旋转盖在上面

css可以啊,不过效果肯定没有图片好。css利用视觉差,然后控制好定位和z-index。

左边部分的原有的大背景,右边部分的背景是右边元素本身的背景。

随便写了一下,效果图大概是这样.真要图上那种效果,就要细调了

clipboard.png

源码:RunJS

方法有很多,也可以用伪元素遮盖住右侧一部分

<div class="content">ABCDEF</div>
<style>
 .content {
  width: 155px;
  height: 100px;
  line-height: 100px;
  text-align: center;
  font-size: 30px;
  background: #365972;
  position: relative;
  overflow: hidden;
}
.content::before {
  position: absolute;
  content: ' ';
  width: 36px;
  height: 118px;
  background: #365972;
  left: 120px;
  top: 0;
  border-left: 2px solid #ffffff;
  transform: rotate(30deg);
}
</style>

写个样式,然后倾斜位移;写样式相对图片还是比较省心

推荐问题