gpt4 book ai didi

javascript - 是否可以将 CSS 应用于字符的一半?

转载 作者:太空狗 更新时间:2023-10-29 13:53:24 25 4
gpt4 key购买 nike

我在找什么:

一种风格的方法的一个字符。 (在这种情况下,一半的字母是透明的)

我目前搜索并尝试过的内容(没有运气):

  • 半个字符/字母的样式设置方法
  • 使用 CSS 或 JavaScript 对字符的一部分进行样式设置
  • 将 CSS 应用于字符的 50%

  • 下面是我试图获得的一个例子。

    x

    是否存在 CSS 或 JavaScript 解决方案,或者我将不得不求助于图像?我不想走图像路线,因为这个文本最终会动态生成。

    更新:

    既然很多人问我为什么要设计 Angular 色的一半,这就是原因。我的城市最近花了 250,000 美元为自己定义一个新的“品牌”。这个 logo 是他们想出的。许多人提示简单和缺乏创造力,并继续这样做。我的目标是想出这个 website 作为一个笑话。输入“哈利法克斯”,你就会明白我的意思。

    最佳答案

    Now on GitHub as a Plugin!

    enter image description here随意 fork 和改进。

    Demo | Download Zip | Half-Style.com (重定向到 GitHub)

  • 纯 CSS 对于单个字符
  • JavaScript 用于跨文本或多个字符的自动化
  • 为盲人或视觉上的屏幕阅读器保留文本可访问性
    受损

  • 第 1 部分:基本解决方案

    Half Style on text

    演示: http://jsfiddle.net/arbel/pd9yB/1694/

    这适用于任何动态文本或单个字符,并且都是自动化的。您需要做的就是在目标文本上添加一个类,剩下的就交给我们了。

    此外,为盲人或视障人士的屏幕阅读器保留了原始文本的可访问性。

    单个字符的解释:

    纯 CSS。您只需申请 .halfStyle类添加到包含您想要半样式的字符的每个元素。

    对于每个包含字符的 span 元素,您可以创建一个数据属性,例如这里 data-content="X" , 在伪元素上使用 content: attr(data-content);所以 .halfStyle:before类将是动态的,您不需要为每个实例硬编码它。

    任何文本的解释:

    只需添加 textToHalfStyle类到包含文本的元素。



    // jQuery for automated mode
    jQuery(function($) {
    var text, chars, $el, i, output;

    // Iterate over all class occurences
    $('.textToHalfStyle').each(function(idx, el) {
    $el = $(el);
    text = $el.text();
    chars = text.split('');

    // Set the screen-reader text
    $el.html('<span style="position: absolute !important;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);">' + text + '</span>');

    // Reset output for appending
    output = '';

    // Iterate over all chars in the text
    for (i = 0; i < chars.length; i++) {
    // Create a styled element for each character and append to container
    output += '<span aria-hidden="true" class="halfStyle" data-content="' + chars[i] + '">' + chars[i] + '</span>';
    }

    // Write to DOM only once
    $el.append(output);
    });
    });
    .halfStyle {
    position: relative;
    display: inline-block;
    font-size: 80px; /* or any font size will work */
    color: black; /* or transparent, any color */
    overflow: hidden;
    white-space: pre; /* to preserve the spaces from collapsing */
    }

    .halfStyle:before {
    display: block;
    z-index: 1;
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    content: attr(data-content); /* dynamic content for the pseudo element */
    overflow: hidden;
    color: #f00;
    }
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

    <p>Single Characters:</p>
    <span class="halfStyle" data-content="X">X</span>
    <span class="halfStyle" data-content="Y">Y</span>
    <span class="halfStyle" data-content="Z">Z</span>
    <span class="halfStyle" data-content="A">A</span>

    <hr/>
    <p>Automated:</p>

    <span class="textToHalfStyle">Half-style, please.</span>


    ( JSFiddle demo)

    第 2 部分:高级解决方案 - 独立的左右部件

    Half Style on text - advanced - With Text Shadow

    使用此解决方案,您可以单独和独立地设置左右部件的样式 .

    一切都是一样的,只有更高级的 CSS 才能发挥作用。

    jQuery(function($) {
    var text, chars, $el, i, output;

    // Iterate over all class occurences
    $('.textToHalfStyle').each(function(idx, el) {
    $el = $(el);
    text = $el.text();
    chars = text.split('');

    // Set the screen-reader text
    $el.html('<span style="position: absolute !important;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);">' + text + '</span>');

    // Reset output for appending
    output = '';

    // Iterate over all chars in the text
    for (i = 0; i < chars.length; i++) {
    // Create a styled element for each character and append to container
    output += '<span aria-hidden="true" class="halfStyle" data-content="' + chars[i] + '">' + chars[i] + '</span>';
    }

    // Write to DOM only once
    $el.append(output);
    });
    });
    .halfStyle {
    position: relative;
    display: inline-block;
    font-size: 80px; /* or any font size will work */
    color: transparent; /* hide the base character */
    overflow: hidden;
    white-space: pre; /* to preserve the spaces from collapsing */
    }

    .halfStyle:before { /* creates the left part */
    display: block;
    z-index: 1;
    position: absolute;
    top: 0;
    width: 50%;
    content: attr(data-content); /* dynamic content for the pseudo element */
    overflow: hidden;
    pointer-events: none; /* so the base char is selectable by mouse */
    color: #f00; /* for demo purposes */
    text-shadow: 2px -2px 0px #af0; /* for demo purposes */
    }

    .halfStyle:after { /* creates the right part */
    display: block;
    direction: rtl; /* very important, will make the width to start from right */
    position: absolute;
    z-index: 2;
    top: 0;
    left: 50%;
    width: 50%;
    content: attr(data-content); /* dynamic content for the pseudo element */
    overflow: hidden;
    pointer-events: none; /* so the base char is selectable by mouse */
    color: #000; /* for demo purposes */
    text-shadow: 2px 2px 0px #0af; /* for demo purposes */
    }
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <p>Single Characters:</p>
    <span class="halfStyle" data-content="X">X</span>
    <span class="halfStyle" data-content="Y">Y</span>
    <span class="halfStyle" data-content="Z">Z</span>
    <span class="halfStyle" data-content="A">A</span>

    <hr/>
    <p>Automated:</p>

    <span class="textToHalfStyle">Half-style, please.</span>


    ( JSFiddle demo)



    第 3 部分:混合搭配和改进

    现在我们知道什么是可能的,让我们创建一些变化。

    -水平半部分
  • 没有文字阴影:

    Horizontal Half Parts - No Text Shadow
  • 每个半部分独立的文本阴影的可能性:

    halfStyle - Horizontal Half Parts - With Text Shadow


  • // jQuery for automated mode
    jQuery(function($) {
    var text, chars, $el, i, output;

    // Iterate over all class occurences
    $('.textToHalfStyle').each(function(idx, el) {
    $el = $(el);
    text = $el.text();
    chars = text.split('');

    // Set the screen-reader text
    $el.html('<span style="position: absolute !important;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);">' + text + '</span>');

    // Reset output for appending
    output = '';

    // Iterate over all chars in the text
    for (i = 0; i < chars.length; i++) {
    // Create a styled element for each character and append to container
    output += '<span aria-hidden="true" class="halfStyle" data-content="' + chars[i] + '">' + chars[i] + '</span>';
    }

    // Write to DOM only once
    $el.append(output);
    });
    });
    .halfStyle {
    position: relative;
    display: inline-block;
    font-size: 80px; /* or any font size will work */
    color: transparent; /* hide the base character */
    overflow: hidden;
    white-space: pre; /* to preserve the spaces from collapsing */
    }

    .halfStyle:before { /* creates the top part */
    display: block;
    z-index: 2;
    position: absolute;
    top: 0;
    height: 50%;
    content: attr(data-content); /* dynamic content for the pseudo element */
    overflow: hidden;
    pointer-events: none; /* so the base char is selectable by mouse */
    color: #f00; /* for demo purposes */
    text-shadow: 2px -2px 0px #af0; /* for demo purposes */
    }

    .halfStyle:after { /* creates the bottom part */
    display: block;
    position: absolute;
    z-index: 1;
    top: 0;
    height: 100%;
    content: attr(data-content); /* dynamic content for the pseudo element */
    overflow: hidden;
    pointer-events: none; /* so the base char is selectable by mouse */
    color: #000; /* for demo purposes */
    text-shadow: 2px 2px 0px #0af; /* for demo purposes */
    }
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <p>Single Characters:</p>
    <span class="halfStyle" data-content="X">X</span>
    <span class="halfStyle" data-content="Y">Y</span>
    <span class="halfStyle" data-content="Z">Z</span>
    <span class="halfStyle" data-content="A">A</span>

    <hr/>
    <p>Automated:</p>

    <span class="textToHalfStyle">Half-style, please.</span>


    ( JSFiddle demo)



    -垂直 1/3 零件
  • 没有文字阴影:

    halfStyle - Vertical 1/3 Parts - No Text Shadow
  • 每个 1/3 部分独立的文本阴影的可能性:

    halfStyle - Vertical 1/3 Parts - With Text Shadow


  • // jQuery for automated mode
    jQuery(function($) {
    var text, chars, $el, i, output;

    // Iterate over all class occurences
    $('.textToHalfStyle').each(function(idx, el) {
    $el = $(el);
    text = $el.text();
    chars = text.split('');

    // Set the screen-reader text
    $el.html('<span style="position: absolute !important;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);">' + text + '</span>');

    // Reset output for appending
    output = '';

    // Iterate over all chars in the text
    for (i = 0; i < chars.length; i++) {
    // Create a styled element for each character and append to container
    output += '<span aria-hidden="true" class="halfStyle" data-content="' + chars[i] + '">' + chars[i] + '</span>';
    }

    // Write to DOM only once
    $el.append(output);
    });
    });
    .halfStyle { /* base char and also the right 1/3 */
    position: relative;
    display: inline-block;
    font-size: 80px; /* or any font size will work */
    color: transparent; /* hide the base character */
    overflow: hidden;
    white-space: pre; /* to preserve the spaces from collapsing */
    color: #f0f; /* for demo purposes */
    text-shadow: 2px 2px 0px #0af; /* for demo purposes */
    }

    .halfStyle:before { /* creates the left 1/3 */
    display: block;
    z-index: 2;
    position: absolute;
    top: 0;
    width: 33.33%;
    content: attr(data-content); /* dynamic content for the pseudo element */
    overflow: hidden;
    pointer-events: none; /* so the base char is selectable by mouse */
    color: #f00; /* for demo purposes */
    text-shadow: 2px -2px 0px #af0; /* for demo purposes */
    }

    .halfStyle:after { /* creates the middle 1/3 */
    display: block;
    z-index: 1;
    position: absolute;
    top: 0;
    width: 66.66%;
    content: attr(data-content); /* dynamic content for the pseudo element */
    overflow: hidden;
    pointer-events: none; /* so the base char is selectable by mouse */
    color: #000; /* for demo purposes */
    text-shadow: 2px 2px 0px #af0; /* for demo purposes */
    }
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

    <p>Single Characters:</p>
    <span class="halfStyle" data-content="X">X</span>
    <span class="halfStyle" data-content="Y">Y</span>
    <span class="halfStyle" data-content="Z">Z</span>
    <span class="halfStyle" data-content="A">A</span>

    <hr/>
    <p>Automated:</p>

    <span class="textToHalfStyle">Half-style, please.</span>


    ( JSFiddle demo)



    -水平 1/3 零件
  • 没有文字阴影:

    halfStyle - Horizontal 1/3 Parts - No Text Shadow
  • 每个 1/3 部分独立的文本阴影的可能性:

    halfStyle - Horizontal 1/3 Parts - With Text Shadow


  • // jQuery for automated mode
    jQuery(function($) {
    var text, chars, $el, i, output;

    // Iterate over all class occurences
    $('.textToHalfStyle').each(function(idx, el) {
    $el = $(el);
    text = $el.text();
    chars = text.split('');

    // Set the screen-reader text
    $el.html('<span style="position: absolute !important;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);">' + text + '</span>');

    // Reset output for appending
    output = '';

    // Iterate over all chars in the text
    for (i = 0; i < chars.length; i++) {
    // Create a styled element for each character and append to container
    output += '<span aria-hidden="true" class="halfStyle" data-content="' + chars[i] + '">' + chars[i] + '</span>';
    }

    // Write to DOM only once
    $el.append(output);
    });
    });
    .halfStyle { /* base char and also the bottom 1/3 */
    position: relative;
    display: inline-block;
    font-size: 80px; /* or any font size will work */
    color: transparent;
    overflow: hidden;
    white-space: pre; /* to preserve the spaces from collapsing */
    color: #f0f;
    text-shadow: 2px 2px 0px #0af; /* for demo purposes */
    }

    .halfStyle:before { /* creates the top 1/3 */
    display: block;
    z-index: 2;
    position: absolute;
    top: 0;
    height: 33.33%;
    content: attr(data-content); /* dynamic content for the pseudo element */
    overflow: hidden;
    pointer-events: none; /* so the base char is selectable by mouse */
    color: #f00; /* for demo purposes */
    text-shadow: 2px -2px 0px #fa0; /* for demo purposes */
    }

    .halfStyle:after { /* creates the middle 1/3 */
    display: block;
    position: absolute;
    z-index: 1;
    top: 0;
    height: 66.66%;
    content: attr(data-content); /* dynamic content for the pseudo element */
    overflow: hidden;
    pointer-events: none; /* so the base char is selectable by mouse */
    color: #000; /* for demo purposes */
    text-shadow: 2px 2px 0px #af0; /* for demo purposes */
    }
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <p>Single Characters:</p>
    <span class="halfStyle" data-content="X">X</span>
    <span class="halfStyle" data-content="Y">Y</span>
    <span class="halfStyle" data-content="Z">Z</span>
    <span class="halfStyle" data-content="A">A</span>

    <hr/>
    <p>Automated:</p>

    <span class="textToHalfStyle">Half-style, please.</span>


    ( JSFiddle demo)



    -HalfStyle改进@KevinGranger

    halfStyle - KevinGranger

    // jQuery for automated mode
    jQuery(function($) {
    var text, chars, $el, i, output;

    // Iterate over all class occurences
    $('.textToHalfStyle').each(function(idx, el) {
    $el = $(el);
    text = $el.text();
    chars = text.split('');

    // Set the screen-reader text
    $el.html('<span style="position: absolute !important;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);">' + text + '</span>');

    // Reset output for appending
    output = '';

    // Iterate over all chars in the text
    for (i = 0; i < chars.length; i++) {
    // Create a styled element for each character and append to container
    output += '<span aria-hidden="true" class="halfStyle" data-content="' + chars[i] + '">' + chars[i] + '</span>';
    }

    // Write to DOM only once
    $el.append(output);
    });
    });
    body {
    background-color: black;
    }

    .textToHalfStyle {
    display: block;
    margin: 200px 0 0 0;
    text-align: center;
    }

    .halfStyle {
    font-family: 'Libre Baskerville', serif;
    position: relative;
    display: inline-block;
    width: 1;
    font-size: 70px;
    color: black;
    overflow: hidden;
    white-space: pre;
    text-shadow: 1px 2px 0 white;
    }

    .halfStyle:before {
    display: block;
    z-index: 1;
    position: absolute;
    top: 0;
    width: 50%;
    content: attr(data-content); /* dynamic content for the pseudo element */
    overflow: hidden;
    color: white;
    }
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <p>Single Characters:</p>
    <span class="halfStyle" data-content="X">X</span>
    <span class="halfStyle" data-content="Y">Y</span>
    <span class="halfStyle" data-content="Z">Z</span>
    <span class="halfStyle" data-content="A">A</span>

    <hr/>
    <p>Automated:</p>

    <span class="textToHalfStyle">Half-style, please.</span>


    ( JSFiddle demo)


    -由 @SamTremaine改进HalfStyle的PeelingStyle

    halfStyle - SamTremaine

    // jQuery for automated mode
    jQuery(function($) {
    var text, chars, $el, i, output;

    // Iterate over all class occurences
    $('.textToHalfStyle').each(function(idx, el) {
    $el = $(el);
    text = $el.text();
    chars = text.split('');

    // Set the screen-reader text
    $el.html('<span style="position: absolute !important;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);">' + text + '</span>');

    // Reset output for appending
    output = '';

    // Iterate over all chars in the text
    for (i = 0; i < chars.length; i++) {
    // Create a styled element for each character and append to container
    output += '<span aria-hidden="true" class="halfStyle" data-content="' + chars[i] + '">' + chars[i] + '</span>';
    }

    // Write to DOM only once
    $el.append(output);
    });
    });
    .halfStyle {
    position: relative;
    display: inline-block;
    font-size: 68px;
    color: rgba(0, 0, 0, 0.8);
    overflow: hidden;
    white-space: pre;
    transform: rotate(4deg);
    text-shadow: 2px 1px 3px rgba(0, 0, 0, 0.3);
    }

    .halfStyle:before { /* creates the left part */
    display: block;
    z-index: 1;
    position: absolute;
    top: -0.5px;
    left: -3px;
    width: 100%;
    content: attr(data-content);
    overflow: hidden;
    pointer-events: none;
    color: #FFF;
    transform: rotate(-4deg);
    text-shadow: 0px 0px 1px #000;
    }
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <p>Single Characters:</p>
    <span class="halfStyle" data-content="X">X</span>
    <span class="halfStyle" data-content="Y">Y</span>
    <span class="halfStyle" data-content="Z">Z</span>
    <span class="halfStyle" data-content="A">A</span>

    <hr/>
    <p>Automated:</p>

    <span class="textToHalfStyle">Half-style, please.</span>


    ( JSFiddle demosamtremaine.co.uk )


    第 4 部分:准备生产

    可以在同一页面上的所需元素上使用定制的不同 Half-Style 样式集。
    您可以定义多个样式集并告诉插件使用哪一个。

    该插件使用数据属性 data-halfstyle="[-CustomClassName-]"在目标上 .textToHalfStyle元素并自动进行所有必要的更改。

    因此,只需在包含文本的元素上添加 textToHalfStyle类和数据属性 data-halfstyle="[-CustomClassName-]" .该插件将完成剩下的工作。

    halfStyle - Multiple on Same Page

    CSS 样式集的类定义也与 [-CustomClassName-] 匹配。上面提到的部分,链接到 .halfStyle ,所以我们将有 .halfStyle.[-CustomClassName-]
    jQuery(function($) {
    var halfstyle_text, halfstyle_chars, $halfstyle_el, halfstyle_i, halfstyle_output, halfstyle_style;

    // Iterate over all class occurrences
    $('.textToHalfStyle').each(function(idx, halfstyle_el) {
    $halfstyle_el = $(halfstyle_el);
    halfstyle_style = $halfstyle_el.data('halfstyle') || 'hs-base';
    halfstyle_text = $halfstyle_el.text();
    halfstyle_chars = halfstyle_text.split('');

    // Set the screen-reader text
    $halfstyle_el.html('<span style="position: absolute !important;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);">' + halfstyle_text + '</span>');

    // Reset output for appending
    halfstyle_output = '';

    // Iterate over all chars in the text
    for (halfstyle_i = 0; halfstyle_i < halfstyle_chars.length; halfstyle_i++) {
    // Create a styled element for each character and append to container
    halfstyle_output += '<span aria-hidden="true" class="halfStyle ' + halfstyle_style + '" data-content="' + halfstyle_chars[halfstyle_i] + '">' + halfstyle_chars[halfstyle_i] + '</span>';
    }

    // Write to DOM only once
    $halfstyle_el.append(halfstyle_output);
    });
    });
    /* start half-style hs-base */

    .halfStyle.hs-base {
    position: relative;
    display: inline-block;
    font-size: 80px; /* or any font size will work */
    overflow: hidden;
    white-space: pre; /* to preserve the spaces from collapsing */
    color: #000; /* for demo purposes */
    }

    .halfStyle.hs-base:before {
    display: block;
    z-index: 1;
    position: absolute;
    top: 0;
    width: 50%;
    content: attr(data-content); /* dynamic content for the pseudo element */
    pointer-events: none; /* so the base char is selectable by mouse */
    overflow: hidden;
    color: #f00; /* for demo purposes */
    }

    /* end half-style hs-base */


    /* start half-style hs-horizontal-third */

    .halfStyle.hs-horizontal-third { /* base char and also the bottom 1/3 */
    position: relative;
    display: inline-block;
    font-size: 80px; /* or any font size will work */
    color: transparent;
    overflow: hidden;
    white-space: pre; /* to preserve the spaces from collapsing */
    color: #f0f;
    text-shadow: 2px 2px 0px #0af; /* for demo purposes */
    }

    .halfStyle.hs-horizontal-third:before { /* creates the top 1/3 */
    display: block;
    z-index: 2;
    position: absolute;
    top: 0;
    height: 33.33%;
    content: attr(data-content); /* dynamic content for the pseudo element */
    overflow: hidden;
    pointer-events: none; /* so the base char is selectable by mouse */
    color: #f00; /* for demo purposes */
    text-shadow: 2px -2px 0px #fa0; /* for demo purposes */
    }

    .halfStyle.hs-horizontal-third:after { /* creates the middle 1/3 */
    display: block;
    position: absolute;
    z-index: 1;
    top: 0;
    height: 66.66%;
    content: attr(data-content); /* dynamic content for the pseudo element */
    overflow: hidden;
    pointer-events: none; /* so the base char is selectable by mouse */
    color: #000; /* for demo purposes */
    text-shadow: 2px 2px 0px #af0; /* for demo purposes */
    }

    /* end half-style hs-horizontal-third */


    /* start half-style hs-PeelingStyle, by user SamTremaine on Stackoverflow.com */

    .halfStyle.hs-PeelingStyle {
    position: relative;
    display: inline-block;
    font-size: 68px;
    color: rgba(0, 0, 0, 0.8);
    overflow: hidden;
    white-space: pre;
    transform: rotate(4deg);
    text-shadow: 2px 1px 3px rgba(0, 0, 0, 0.3);
    }

    .halfStyle.hs-PeelingStyle:before { /* creates the left part */
    display: block;
    z-index: 1;
    position: absolute;
    top: -0.5px;
    left: -3px;
    width: 100%;
    content: attr(data-content);
    overflow: hidden;
    pointer-events: none;
    color: #FFF;
    transform: rotate(-4deg);
    text-shadow: 0px 0px 1px #000;
    }

    /* end half-style hs-PeelingStyle */


    /* start half-style hs-KevinGranger, by user KevinGranger on StackOverflow.com*/

    .textToHalfStyle.hs-KevinGranger {
    display: block;
    margin: 200px 0 0 0;
    text-align: center;
    }

    .halfStyle.hs-KevinGranger {
    font-family: 'Libre Baskerville', serif;
    position: relative;
    display: inline-block;
    width: 1;
    font-size: 70px;
    color: black;
    overflow: hidden;
    white-space: pre;
    text-shadow: 1px 2px 0 white;
    }

    .halfStyle.hs-KevinGranger:before {
    display: block;
    z-index: 1;
    position: absolute;
    top: 0;
    width: 50%;
    content: attr(data-content); /* dynamic content for the pseudo element */
    overflow: hidden;
    color: white;
    }

    /* end half-style hs-KevinGranger
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <p>
    <span class="textToHalfStyle" data-halfstyle="hs-base">Half-style, please.</span>
    </p>
    <p>
    <span class="textToHalfStyle" data-halfstyle="hs-horizontal-third">Half-style, please.</span>
    </p>
    <p>
    <span class="textToHalfStyle" data-halfstyle="hs-PeelingStyle">Half-style, please.</span>
    </p>
    <p style="background-color:#000;">
    <span class="textToHalfStyle" data-halfstyle="hs-KevinGranger">Half-style, please.</span>
    </p>


    ( JSFiddle demo)

    关于javascript - 是否可以将 CSS 应用于字符的一半?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34840419/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com