Is it possible to apply CSS to half of a character?

后端 未结 19 1883
轻奢々
轻奢々 2020-11-22 16:46

What I am looking for:

A way to style one HALF of a character. (In this case, half the letter being transparent)

Wh

19条回答
  •  悲&欢浪女
    2020-11-22 17:21

    enter image description here


    I've just finished developing the plugin and it is available for everyone to use! Hope you will enjoy it.

    View Project on GitHub - View Project Website. (so you can see all the split styles)

    Usage

    First of all, make sure you have the jQuery library is included. The best way to get the latest jQuery version is to update your head tag with:

    
    

    After downloading the files, make sure you include them in your project:

    
    
    

    Markup

    All you have to do is to asign the class splitchar , followed by the desired style to the element wrapping your text. e.g

    Splitchar

    After all this is done, just make sure you call the jQuery function in your document ready file like this:

    $(".splitchar").splitchar();
    

    Customizing

    In order to make the text look exactly as you want it to, all you have to do is apply your design like this:

    .horizontal { /* Base CSS - e.g font-size */ }
    .horizontal:before { /* CSS for the left half */ }
    .horizontal:after { /* CSS for the right half */ }
    


    That's it! Now you have the Splitchar plugin all set. More info about it at http://razvanbalosin.com/Splitchar.js/.

提交回复
热议问题