直接上 CSS 代码
a {
display: inline-block;
color: #404040;
text-decoration: none;
overflow: hidden;
position: relative;
}
a::before {
content: attr(data-letters);
color: #f34540;
width: 0;
background: #fff;
overflow: hidden;
position: absolute;
top: 0;
left: 0;
z-index: 2;
white-space: nowrap;
transition: width .5s;
}
a:hover::before{
width: 100%;
transition: width .5s;
}
然后就是 HTML 范例
测试一下文字的渐变特效
@echo off
title 开发环境控制面板
:act_main
cls
echo ----------------------------
echo.
echo 1、启动全部服务
echo 2、停止全部服务
echo.
echo 3、启动单个服务
echo 4、停止单个服务
echo.
echo 按 Q 键退出
echo.
echo ----------------------------
echo.
choice /c:1234q /n /m "请输入命令:"
if %errorlevel% EQU 1 goto start_all
if %errorlevel% EQU 2 goto stop_all
if %errorlevel% EQU 3 goto start_one
if %errorlevel% EQU 4 goto stop_one
if %errorlevel% EQU 5 goto act_exit
:act_exit
exit
goto :eof
:start_one
cls
echo ----------------------------
echo.
echo 1、启动 Nginx
echo 2、启动 PHP
echo 3、启动 Memcache
echo 4、启动 MySQL
echo 5、返回
echo.
echo 按 Q 键退出
echo.
echo ----------------------------
choice /c:12345q /n /m "请输入命令:"
if %errorlevel% EQU 1 goto start_nginx
if %errorlevel% EQU 2 goto start_php
if %errorlevel% EQU 3 goto start_memcached
if %errorlevel% EQU 4 goto start_mysql
if %errorlevel% EQU 5 goto act_main
if %errorlevel% EQU 6 goto act_exit
:stop_one
cls
echo ----------------------------
echo.
echo 1、停止 Nginx
echo 2、停止 PHP
echo 3、停止 Memcached
echo 4、停止 MySQL
echo 5、返回
echo.
echo 按 Q 键退出
echo.
echo ----------------------------
choice /c:12345q /n /m "请输入命令:"
if %errorlevel% EQU 1 goto stop_nginx
if %errorlevel% EQU 2 goto stop_php
if %errorlevel% EQU 3 goto stop_memcached
if %errorlevel% EQU 4 goto stop_mysql
if %errorlevel% EQU 5 goto act_main
if %errorlevel% EQU 6 goto act_exit
:start_all
cls
set "act_type=1"
goto start_nginx
:stop_all
cls
set "act_type=1"
goto stop_nginx
ram ---------- 启动 Nginx -------------
:start_nginx
tasklist | find /i "nginx.exe" > Nul && set "nginx_status=1" || set "nginx_status=0"
if "%nginx_status%" == "1" (
echo Nginx 服务已启动
) else (
echo Nginx 服务正在启动 .
C:\Server\RunHiddenConsole.exe C:\Server\Nginx\nginx.exe -p C:\Server\Nginx
tasklist | find /i "nginx.exe" > Nul && echo Nginx 服务已经启动成功。 || echo Nginx 服务启动失败。
)
echo.
if "%act_type%" == "1" (
goto start_php
)
sleep 3
exit
goto :eof
ram ---------- 启动 PHP FastCGI -------------
:start_php
tasklist | find /i "php-cgi.exe" > Nul && set "php_status=1" || set "php_status=0"
if "%php_status%" == "1" (
echo PHP FastCGI 服务已启动
) else (
echo PHP FastCGI 服务正在启动 .
C:\Server\RunHiddenConsole.exe C:\Server\PHP\php-cgi.exe -b 127.0.0.1:9999
tasklist | find /i "php-cgi.exe" > Nul && echo PHP FastCGI 服务已经启动成功。 || echo PHP FastCGI 服务启动失败。
)
echo.
if "%act_type%" == "1" (
goto start_memcached
)
sleep 3
exit
goto :eof
ram ---------- 启动 Memcached -------------
:start_memcached
net start | find /i "memcached" > Nul && set "memcached_status=1" || set "memcached_status=0"
if "%memcached_status%" == "1" (
echo Memcached 服务已启动。
echo.
) else (
net start memcached
)
if "%act_type%" == "1" (
goto start_mysql
)
sleep 3
exit
goto :eof
ram ---------- 启动 MariaDB -------------
:start_mysql
net start | find /i "MariaDB" > Nul && set "mariadb_status=1" || set "mariadb_status=0"
if "%mariadb_status%" == "1" (
echo MariaDB 服务已启动。
echo.
) else (
net start MariaDB
)
sleep 3
exit
goto :eof
ram ---------- 停止 Nginx -------------
:stop_nginx
tasklist | find /i "nginx.exe" > Nul && set "nginx_status=1" || set "nginx_status=0"
if "%nginx_status%" == "1" (
echo Nginx 服务正在停止 .
taskkill /F /IM nginx.exe > nul
tasklist | find /i "nginx.exe" > Nul && echo Nginx 服务停止失败。 || echo Nginx 服务已成功停止。
) else (
echo 没有启动 Ngnix 服务。
)
echo.
if "%act_type%" == "1" (
goto stop_php
)
sleep 3
exit
goto :eof
ram ---------- 停止 PHP FastCGI -------------
:stop_php
tasklist | find /i "php-cgi.exe" > Nul && set "php_status=1" || set "php_status=0"
if "%php_status%" == "1" (
echo PHP FastCGI 服务正在停止 .
taskkill /F /IM php-cgi.exe > nul
tasklist | find /i "php-cgi.exe" > Nul && echo PHP FastCGI 服务停止失败。 || echo PHP FastCGI 服务已成功停止。
) else (
echo 没有启动 PHP FastCGI 服务。
)
echo.
if "%act_type%" == "1" (
goto stop_memcached
)
sleep 3
exit
goto :eof
ram ---------- 停止 Memcached -------------
:stop_memcached
net start | find /i "memcached" > Nul && set "memcached_status=1" || set "memcached_status=0"
if "%memcached_status%" == "1" (
net stop memcached
) else (
echo 没有启动 Memcached 服务。
echo.
)
if "%act_type%" == "1" (
goto stop_mysql
)
sleep 3
exit
goto :eof
ram ---------- 停止 MariaDB -------------
:stop_mysql
net start | find /i "MariaDB" > Nul && set "mariadb_status=1" || set "mariadb_status=0"
if "%mariadb_status%" == "1" (
net stop MariaDB
) else (
echo 没有启动 MariaDB 服务。
echo.
)
sleep 3
exit
goto :eof