DIV+CSS如何让字体自动变颜色?

html-css012

DIV+CSS如何让字体自动变颜色?,第1张

需要准备的材料分别有:电脑、浏览器、html编辑器。

1、首先,打开html编辑器,新建html文件,例如:index.html。

2、在index.html中的<style>标签中,输入css代码:。

body {

animation: change 3s linear 0s infinite

}

@keyframes change {

0% {color: #333}

50% {color: #f60}

100% {color: #f00}

}

3、浏览器运行index.html页面,此时字体颜色会随着时间的变化而自动变化。

1、首先,打开HTML编辑器并创建一个新的HTML文件,比如index.html。

2、在index.html中的<style>标签中,输入css代码:button {background-color: #00a7d0}

button:hover {background-color: #ff7701}。

3、当浏览器运行索引index.html页面中,出现蓝色背景颜色的按钮。

4、将鼠标移到按钮上,按钮的背景颜色将变为橙色。

<h2 class="text-gradient">CSS如何实现文字颜色渐变的实例</h2>

<style>

.text-gradient {  

    display: inline-block

    color: green

    font-size: 10em

    font-family: '微软雅黑'

    background-image: -webkit-gradient(linear, 0 0, 0 bottom, from(rgba(0, 0, 0, 1)), to(rgba(51, 51, 51, 1)))

    -webkit-background-clip: text

    -webkit-text-fill-color: transparent

}

</style>