在线教程

  • css gradients

    ... 个方向。 我们看下具体的实例: div{ background-image: linear-gradient(red, blue);} <div>一个简单的文本背景色垂直渐变</div> ... 认值,等同于to bottom,从上到下。 div{ background-image: linear-gradient(20deg, green, blue); width: 150px;} <div>带20度倾斜的对角线渐变</div> ...

  • html canvas drawimage

    ... 到开始修改像素颜色值的位置坐标(x,y)。将下面的代码加到trueX和trueY的赋值语句后面: var pos = (trueY*(imageData.width*4))+(trueX*4); pixels[pos] = red; pixels[pos+1] = green; pixels[pos+2] = blue; pixels[pos+3] = 255; 这里并没有出现新代码,它只是访问像素的红色颜色值,然后使用之前设置的颜色值进行赋值。因为这里从0开始计算,所以 ...

  • html canvas image effects

    ... for (var i = 0; i < numPixels; i++) { var average = (pixels[i*4]+pixels[i*4+1]+pixels[i*4+2])/3; pixels[i*4] = average; // Red pixels[i*4+1] = average; // Green pixels[i*4+2] = average; // Blue }; 将彩色转换为灰度要求计算出现有颜色值的平均值,即将它们加在一起然后除以颜色个数。 ...

  • css animations

    11.5 CSS 动画(animations) 时间维度上的状态序列组合 我们前面提到过,转换(transitions) 实际上就是一种特殊的CSS动画: 只有两个状态: 起始状态和终止状态 动画不会出现循环 中间状态只能由时变函数(transition-timing-function)来控制 实际动画需求要复杂得多,比如我们可能会需要: 自动播放的动画(不会有交互状态) 控制中间状态 ...

  • html canvas states

    ... restore。现在,如果你绘制另一个正方形,并且这次将fillStyle设置为蓝色,那么很快会看到画布绘图状态的好处: context.fillStyle = "rgb(0, 0, 255)"; context.fillRect(200, 50, 100, 100); // Blue square 这里并没有执行任何特殊操作,唯一修改的是填充颜色。 但是,如果你想换回之前使用的红色填充颜色,该怎么做呢?你无需再次重写 ...

  • css pseudo classes

    ... 添加样式。我们可以把这个伪类用于链接。因为悬停是最基本的链接交互动作。 a{ color: blue;} a:hover{ color: red;} 悬停在这个链接上,文本颜色会变红。 第一行定义所有的 & ... ; padding: 5px;} .form-input:focus{ background: lightyellow; border-color: blue; outline: none;} :checked :checked伪类是CSS3引入的一个很棒的状态选 ...

  • css transitions

    ... -delay 用来定义在动画开始之前需要等待多长时间。 和 transition-duration 一样,你可以使用秒或毫秒来定义。 a{ background: blue; color: white; transition: all 1s;} div:hover a{ background: red;} a.with-delay{ transition-delay: 2s;} <div> <p>请悬停在本灰色区域并等待2秒</p> <a ...

  • sass variables

    ... use $green throughout your CSS. What you actually want is use your primary color, which happens to be green. If you decided to use $blue as your primary color, you’d only have to modify a single line. For any type of value We’ve used variables to ...

  • css priority

    ... 我们分别使用标签(tag)、类(class)和ID选择器来设置元素的颜色: p{ color: blue;} .message{ color: green;} #introduction{ color: red;} 这3条CSS规则都选定了上述的p元素 ... ,后者具有更好的语义描述性 避免使用内联样式(inline styles) 比如 <div style="background: blue;"> 当然上面的只是一般性建议,很多场合下给一个HTML元素添加多个类是有益的,比如给 ...

  • syntax definition

    ... 用来描述属性缩写中的各部分。 <'border-width'> || <'border-style'> || <'border-color'> 以下均为该例的合法取值: 1em solid blue blue 1em solid 1px yellow 但以下不是合法取值: blue yellow因为一个组成部分最多出现一次。 bold因为它不允许出现。 “与”组合符的优先级高于“或”组合符 ...

推广服务(新)
最新文章