Is it possible to get cut out text effect like this using CSS/CSS3 only?

前端 未结 7 1864
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-01 08:40

Is it possible to get cut out text effect like this using CSS/CSS3 only? or image is the only option to get this effect.

7条回答
  •  执笔经年
    2021-02-01 09:04

    I found this http://jsfiddle.net/NeqCC/

    It supports white background and dark text

    All credit goes to the creator

    HTML

    
    

    Inset text-shadow trick

    CSS

    body {
        /* This has to be same as the text-shadows below */
        background: #def;
    }
    h1 {
        font-family: Helvetica, Arial, sans-serif;
        font-weight: bold;
        font-size: 6em;
        line-height: 1em;
    }
    .inset-text {
        /* Shadows are visible under slightly transparent text color */
        color: rgba(10,60,150, 0.8);
        text-shadow: 1px 4px 6px #def, 0 0 0 #000, 1px 4px 6px #def;
    }
    /* Don't show shadows when selecting text */
    ::-moz-selection { background: #5af; color: #fff; text-shadow: none; }
    ::selection { background: #5af; color: #fff; text-shadow: none; }
    

提交回复
热议问题