Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html CSS-如何使单词的结尾模糊?_Html_Css_Blur - Fatal编程技术网

Html CSS-如何使单词的结尾模糊?

Html CSS-如何使单词的结尾模糊?,html,css,blur,Html,Css,Blur,我真的很喜欢推特如何模糊长名称的结尾,当你在带有消息的框上移动光标时 我想尝试做一些类似的事情,但有一点不同-我有一个DIV(比如说宽度:100px;),当里面的文本长于100px时-那么将是相应文本的结尾模糊 谁能给我一些例子/来源/建议,怎么做 多谢各位 您将另一个DIV放置在该DIV的正上方,并为其提供半透明的PNG背景,该背景从完全透明变为完全白色。比如: <div style="position: relative; width: 100px"> @GuyKawas

我真的很喜欢推特如何模糊长名称的结尾,当你在带有消息的框上移动光标时

我想尝试做一些类似的事情,但有一点不同-我有一个DIV(比如说宽度:100px;),当里面的文本长于100px时-那么将是相应文本的结尾模糊

谁能给我一些例子/来源/建议,怎么做

多谢各位


您将另一个DIV放置在该DIV的正上方,并为其提供半透明的PNG背景,该背景从完全透明变为完全白色。比如:

<div style="position: relative; width: 100px">
    @GuyKawasaki
   <div style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; background-image:url(overlay.png)"></div>
</div>

@圭川崎

使用以下HTML:

<div>
    <span>@someUserName</span>
</div>​

当然,您也可以在生成的内容中使用百分比宽度:


针对下面的评论编辑了,报告IE 8(可能更低)不适用于上述解决方案:

但在IE8中不为我工作

我已将HTML更新为以下内容:

<div>
    <span>@someUserName
        <!--[if ie]>
            <span class="ieFadeout"></span>
        <![endif]-->
    </span>
</div>​

参考资料:


看看这里[Gradient text][1][1]:我非常喜欢这个解决方案!但不是在IE8为我工作。。你会推荐一个图像的回退吗?或者有没有一种方法可以让它在所有的浏览器中正常工作;我不确定。我的印象是IE8,至少。我有一种感觉,您可能必须使用条件样式表,并可能在内容中使用额外的元素,而不是生成内容。唉。我没有完全测试,我只是很高兴在chrome中打开你的JSFIDLE,我想在IE中试试。。也许这是一件小事?不;它在我自己的IE8测试中也失败了。唉。不过,请参见编辑。后来的版本在我可以访问的WinXP/IE8中工作;希望它也能为你工作。而且,它没有失去与其他浏览器的兼容性,所以应该可以。尽管(不幸的)更混乱。
<div>
    <span>@someUserName
        <!--[if ie]>
            <span class="ieFadeout"></span>
        <![endif]-->
    </span>
</div>​
div > span {
    display: inline-block;
    position: relative;
}

div > span::after {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 3em;
    content: '';
    background: -moz-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(255,255,255,0)), color-stop(100%,rgba(255,255,255,1))); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(left, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(left, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(left, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%); /* IE10+ */
    background: linear-gradient(left, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00ffffff', endColorstr='#ffffff',GradientType=1 ); /* IE6-9 */
}

span > .ieFadeout {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 3em;
    background-color: transparent;
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00ffffff', endColorstr='#ffffff',GradientType=1 ); /* IE6-9 */

}​