Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/85.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 在浏览器中进行设计时,如何调整文本的渐变?_Html_Css_Web_Png - Fatal编程技术网

Html 在浏览器中进行设计时,如何调整文本的渐变?

Html 在浏览器中进行设计时,如何调整文本的渐变?,html,css,web,png,Html,Css,Web,Png,最近,我一直在练习在浏览器中进行设计,并使用纯代码而不是图像来实现效果。我已经使用并看到了几种为网站文本添加渐变的方法,例如: (但此步骤使用的是.png透明图像) 以及纯代码选项: h1 { position: relative; font-size: 70px; margin-top: 0; font-family: 'Lobster', helvetica, arial; } h1 a

最近,我一直在练习在浏览器中进行设计,并使用纯代码而不是图像来实现效果。我已经使用并看到了几种为网站文本添加渐变的方法,例如:

(但此步骤使用的是
.png
透明图像)

以及纯代码选项:

h1 {  
        position: relative;  
        font-size: 70px;  
        margin-top: 0;  
        font-family: 'Lobster', helvetica, arial;  
    }  

    h1 a {  
        text-decoration: none;  
        color: #666;  
        position: absolute;  

        -webkit-mask-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0,0,0,1)), color-stop(50%, rgba(0,0,0,.5)), to(rgba(0,0,0,1)));  
    }  

    h1:after {  
        content : 'Hello World';  
        color: #d6d6d6;  
        text-shadow: 0 1px 0 white;  
    }  
但我很想知道:

  • 如何调整渐变的位置
  • 是否有一种更简单的方法来为所有类似的浏览器(不包括IE)编写代码
  • 我回顾了以前的一些帖子,但没有涉及调整梯度:


    要调整渐变的位置,您必须编辑以下行(不确定在哪里):


    一个超级酷的工具,有助于这是。它在过去帮助过我很多次。它甚至可以创建所有特定于浏览器的样式。这可能是一个很好的起点。

    要调整渐变的位置,您必须编辑以下行(不确定在哪里):

    一个超级酷的工具,有助于这是。它在过去帮助过我很多次。它甚至可以创建所有特定于浏览器的样式。也许是个好的开始

    h1 {  
            position: relative;  
            font-size: 70px;  
            margin-top: 0;  
            font-family: 'Lobster', helvetica, arial;  
        }  
    
        h1 a {  
            text-decoration: none;  
            color: #666;  
            position: absolute;  
    
            -webkit-mask-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0,0,0,1)), color-stop(50%, rgba(0,0,0,.5)), to(rgba(0,0,0,1)));  
        }  
    
        h1:after {  
            content : 'Hello World';  
            color: #d6d6d6;  
            text-shadow: 0 1px 0 white;  
        }  
    
        -webkit-mask-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0,0,0,1)), color-stop(50%, rgba(0,0,0,.5)), to(rgba(0,0,0,1)));