文字效果集中营
本帖最后由 马黑黑 于 2024-1-18 08:30 编辑 <br /><br /><style type="text/css">#linkBox { column-count: 3; column-gap: 10px; }
#linkBox a{ text-decoration: none; }
#linkBox a:hover{ color: red; }
</style>
<div id="linkBox"></div>
<script language="javascript">
var hrefAr = [
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1478607&fromuid=7130', '随机多彩文本'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1478611&fromuid=7130', '画布渐变色彩文字+逐字上屏'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1478622&fromuid=7130', 'CSS空心字(基于webkit内核浏览器)'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1478660&fromuid=7130', '长阴影立体文字'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1478737&fromuid=7130', 'js打字特效'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1478860&fromuid=7130', '通用阴影立体字'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1479047&fromuid=7130', 'CSS内嵌字'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1479090&fromuid=7130', 'CSS文本静态发光'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1479158&fromuid=7130', 'CSS文本动态发光'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1479283&fromuid=7130', 'CSS文字摇摆'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1479321&fromuid=7130', 'CSS火焰文字'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1479849&fromuid=7130', 'svg环形文字'],
['https://www.huachaowang.com/forum.php?mod=viewthread&tid=57720&extra=page%3D1', '字节菇凉'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1480915&fromuid=7130', '波浪字(文本小-大-小渐变效果)'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1480938&fromuid=7130', 'CSS斜纹字'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1481386&fromuid=7130', '文字逐字移行'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1481614&fromuid=7130', '纯CSS仿生文字'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1481618&fromuid=7130', '纯CSS幻色文本'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1481635&fromuid=7130', 'CSS 3d文字'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1481638&fromuid=7130', 'CSS凹凸文字'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57517&pid=1482295&fromuid=7130', 'CSS反转文字方向'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1482303&fromuid=7130', '纯CSS单行打字效果'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1482606&fromuid=7130', 'svg心形文本'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1482696&fromuid=7130', '文本随机轮番显示'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1483867&fromuid=7130', '纯CSS文本自动变色'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1484770&fromuid=7130', '毛玻璃文本效果'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1484979&fromuid=7130', '另一种毛玻璃效果'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1485354&fromuid=7130', 'SVG空心字与描边字'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1485360&fromuid=7130', 'SVG错落排版'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1486296&fromuid=7130', '动态变色文本'],
['https://www.huachaowang.com/forum.php?mod=viewthread&tid=57894&page=1&extra=#pid1488586', 'svg文本淡入淡出'],
['https://www.huachaowang.com/forum.php?mod=viewthread&tid=56619&fromuid=2', 'CSS模拟marquee效果'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1492987&fromuid=7130', 'CSS+JS风车字'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1496664&fromuid=7130', 'JS自下而上走马灯'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1496694&fromuid=7130', 'JS自右向左走马灯'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1496891&fromuid=7130', '纯CSS自下而上走马灯'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1497697&fromuid=7130','变换背景色文本'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1497817&fromuid=7130','CSS简易走马灯'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1504951&fromuid=7130','跳舞的文本'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1506879&fromuid=7130','纯CSS模糊文本'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1518241&fromuid=7130','多面体彩环字幕'],
['https://www.huachaowang.com/forum.php?mod=viewthread&tid=58556&pid=1518581&page=1&extra=#pid1518581','文本与图片的融合效果'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=56347&pid=1520862&fromuid=7130','CSS+JS环形多彩文本'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1528086&fromuid=7130','稿纸样式一'],
['https://www.huachaowang.com/forum.php?mod=viewthread&tid=58766&extra=page%3D1','花潮信笺'],
['https://www.huachaowang.com/forum.php?mod=viewthread&tid=58794&extra=page%3D1','方格稿纸'],
['https://www.huachaowang.com/forum.php?mod=viewthread&tid=58803&extra=page%3D1','虚线网格稿纸'],
['https://www.huachaowang.com/forum.php?mod=viewthread&tid=58763&highlight=%CA%E9%D2%B3','纯CSS书页样式'],
['https://www.huachaowang.com/forum.php?mod=viewthread&tid=59913&highlight=%B5%B9%D3%B0','倒影字'],
['https://www.huachaowang.com/forum.php?mod=redirect&goto=findpost&ptid=57643&pid=1699147&fromuid=7130','svg动态描边文本'],
['https://www.huachaowang.com/thread-63282-1-1.html','纯CSS描边字'],
['https://www.huachaowang.com/forum.php?mod=viewthread&tid=73676&page=1&extra=#pid2041878','烟消云散:CSS文本特效']
];
var str = '';
for(x in hrefAr) {
str += (parseInt(x)+1) + '. <a href="' + hrefAr + '">' + hrefAr + '</a><br>';
}
document.getElementById("linkBox").innerHTML = str;
</script> 这是我N年前制作的随机生成多彩文字的JS代码,当时用于处理dom中的特定元素内的文字,我修改了一下,下面的代码可用于重置指定id标识盒子内的文本,但会破坏掉盒子里的HTML结构(如<p>、<br />等等标签全部被去掉):
<div id="colorText" style="margin: auto; width: 600px; font-size: 1.5em;">
<p>RGB色彩模式是工业界的一种颜色标准,是通过对红(R)、绿(G)、蓝(B)三个颜色通道的变化以及它们相互之间的叠加来得到各式各样的颜色的,RGB即是代表红、绿、蓝三个通道的颜色,这个标准几乎包括了人类视力所能感知的所有颜色,是运用最广的颜色系统之一。</p>
</div>
<script language="javascript">
var txtBox = document.getElementById('colorText');
txtBox.innerHTML = colorWord(txtBox.innerHTML);
//随机生成rgb色
function mkRgb(){
var r = Math.round(Math.random()*255);
var g = Math.round(Math.random()*255);
var b = Math.round(Math.random()*255);
return 'rgb(' + r + ',' + g + ',' + b + ')';
}
function colorWord(str){
str =str.replace(/<[^>]*>|<\/[^>]*>/gm, ""); //去掉HTML标签
console.log(str);
var newstr = ''; //新字串
for(i=0; i<str.length; i++){
newstr += '<span style="color:' + mkRgb() + ';">' + str.substr(i,1) + '</span>';
}
return newstr; //返回新字串
}
</script>
<p>效果:<br><br> </p>
<div id="colorText" style="margin: auto; width: 760px; font-size: 1.5em;">
<p>RGB色彩模式是工业界的一种颜色标准,是通过对红(R)、绿(G)、蓝(B)三个颜色通道的变化以及它们相互之间的叠加来得到各式各样的颜色的,RGB即是代表红、绿、蓝三个通道的颜色,这个标准几乎包括了人类视力所能感知的所有颜色,是运用最广的颜色系统之一。</p>
</div>
<script language="javascript">
var txtBox = document.getElementById('colorText');
txtBox.innerHTML = colorWord(txtBox.innerHTML);
//随机生成rgb色
function mkRgb(){
var r = Math.round(Math.random()*255);
var g = Math.round(Math.random()*255);
var b = Math.round(Math.random()*255);
return 'rgb(' + r + ',' + g + ',' + b + ')';
}
function colorWord(str){
str =str.replace(/<[^>]*>|<\/[^>]*>/gm, ""); //去掉HTML标签
console.log(str);
var newstr = ''; //新字串
for(i=0; i<str.length; i++){
newstr += '<span style="color:' + mkRgb() + ';">' + str.substr(i,1) + '</span>';
}
return newstr; //返回新字串
}
</script>
下面代码基于画布,实现:① 多彩文本;② 文字逐字上屏——
<div style="margin: auto;width: 600px; text-align: center;">
<canvas id="scanv" width="500" height="300" style="background: #000;"></canvas>
<br><br><input type="button" id="upText" value=" 逐字上屏" />
</div>
<script>
var str = "天高幾許問真龍";
var strAr = str.split(""); //逐字拆分字串
var loadText; //定时器句柄
var idx = 0; //下标变量
var c = document.getElementById("scanv");
var ct = c.getContext("2d");
strOut(str, 30, 160); //输出彩色文本
document.getElementById("upText").onclick = function(){
/* 按钮单击事件匿名函数
调用 setInterval 定时器实现逐字输出
*/
c.width = c.width;
loadText = setInterval(function(){
strOut(strAr, 30 + idx*60, 160);
idx += 1;
if(idx > strAr.length - 1){
clearInterval(loadText);
idx = 0;
}
},600);
}
function strOut(string,x,y){
/* 输出色彩文本函数
string : 文本串
xy : 起始位置
*/
ct.font = "bold 60px 黑体";
var grd = ct.createRadialGradient(240, 100, 30, 260, 160, 240);
grd.addColorStop(0, "red");
grd.addColorStop(0.2, "green");
grd.addColorStop(0.5, "olive");
grd.addColorStop(0.6, "blue");
grd.addColorStop(0.8, "tomato");
grd.addColorStop(1, "darkgreen");
ct.shadowBlur = 10; //阴影模糊级别
ct.shadowColor = "#aaa"; //阴影颜色
ct.shadowoffX = 8; //阴影x坐标位置
ct.shadowoffY =8; //阴影y坐标位置
ct.fillStyle = grd; //填充样式
ct.fillText(string, x, y);
}
</script>
<div style="margin: auto;width: 600px; text-align: center;">
<canvas id="scanv" width="500" height="300" style="background: #000;"></canvas>
<br><br><input type="button" id="upText" value=" 逐字上屏" />
</div>
<script>
var str = "天高幾許問真龍";
var strAr = str.split(""); //逐字拆分字串
var loadText; //定时器句柄
var idx = 0; //下标变量
var c = document.getElementById("scanv");
var ct = c.getContext("2d");
strOut(str, 30, 160);
document.getElementById("upText").onclick = function(){
/* 按钮单击事件匿名函数
调用 setInterval 定时器实现逐字输出
*/
c.width = c.width;
loadText = setInterval(function(){
strOut(strAr, 30 + idx*60, 160);
idx += 1;
if(idx > strAr.length - 1){
clearInterval(loadText);
idx = 0;
}
},600);
}
function strOut(string,x,y){
/* 输出色彩文本函数
string : 文本串
xy : 起始位置
*/
ct.font = "bold 60px 黑体";
var grd = ct.createRadialGradient(240, 100, 30, 260, 160, 240);
grd.addColorStop(0, "red");
grd.addColorStop(0.2, "green");
grd.addColorStop(0.5, "olive");
grd.addColorStop(0.6, "blue");
grd.addColorStop(0.8, "tomato");
grd.addColorStop(1, "darkgreen");
ct.shadowBlur = 10; //阴影模糊级别
ct.shadowColor = "#aaa"; //阴影颜色
ct.shadowoffX = 8; //阴影x坐标位置
ct.shadowoffY =8; //阴影y坐标位置
ct.fillStyle = grd; //填充样式
ct.fillText(string, x, y);
}
</script>
下面的CSS空心字基于 webkit 内核的浏览器。该内核的浏览器最经典的代表是谷歌Chrome、苹果Safari和改头换面后的微软Edge。看代码:
<style type="text/css">
.kongxin {
margin: auto;
text-align: center;
-webkit-text-fill-color: transparent;
-webkit-text-stroke: 1px darkred;
font-size: 4em;
font-weight: bold;
}
</style>
<div class="kongxin">
<p>CSS空心字演示</p>
</div>
<style type="text/css">
.kongxin {
margin: auto;
text-align: center;
-webkit-text-fill-color: transparent;
-webkit-text-stroke: 1px darkred;
font-size: 4em;
font-weight: bold;
}
</style>
<p>效果:<br><br> </p>
<div class="kongxin">
<p>CSS空心字演示</p>
</div>
长阴影立体文字
text-shadow 属性这是别人用 sass 编写的,很长,凭空写不出来,必须借助CSS扩展工具通过编程来完成,然后转换成CSS代码(论坛需要)。演示代码:
<style type="text/css">
.myBox {
font-size: 4em;
font-weight: bold;
color: #ff6333;
text-shadow: 0px 0px #992400, 1px 1px rgba(152, 36, 1, 0.98), 2px 2px rgba(151, 37, 2, 0.96), 3px 3px rgba(151, 37, 2, 0.94), 4px 4px rgba(150, 37, 3, 0.92), 5px 5px rgba(149, 38, 4, 0.9), 6px 6px rgba(148, 38, 5, 0.88), 7px 7px rgba(148, 39, 5, 0.86), 8px 8px rgba(147, 39, 6, 0.84), 9px 9px rgba(146, 39, 7, 0.82), 10px 10px rgba(145, 40, 8, 0.8), 11px 11px rgba(145, 40, 8, 0.78), 12px 12px rgba(144, 41, 9, 0.76), 13px 13px rgba(143, 41, 10, 0.74), 14px 14px rgba(142, 41, 11, 0.72), 15px 15px rgba(142, 42, 11, 0.7), 16px 16px rgba(141, 42, 12, 0.68), 17px 17px rgba(140, 43, 13, 0.66), 18px 18px rgba(139, 43, 14, 0.64), 19px 19px rgba(138, 43, 15, 0.62), 20px 20px rgba(138, 44, 15, 0.6), 21px 21px rgba(137, 44, 16, 0.58), 22px 22px rgba(136, 45, 17, 0.56), 23px 23px rgba(135, 45, 18, 0.54), 24px 24px rgba(135, 45, 18, 0.52), 25px 25px rgba(134, 46, 19, 0.5), 26px 26px rgba(133, 46, 20, 0.48), 27px 27px rgba(132, 47, 21, 0.46), 28px 28px rgba(132, 47, 21, 0.44), 29px 29px rgba(131, 48, 22, 0.42), 30px 30px rgba(130, 48, 23, 0.4), 31px 31px rgba(129, 48, 24, 0.38), 32px 32px rgba(129, 49, 24, 0.36), 33px 33px rgba(128, 49, 25, 0.34), 34px 34px rgba(127, 50, 26, 0.32), 35px 35px rgba(126, 50, 27, 0.3), 36px 36px rgba(125, 50, 28, 0.28), 37px 37px rgba(125, 51, 28, 0.26), 38px 38px rgba(124, 51, 29, 0.24), 39px 39px rgba(123, 52, 30, 0.22), 40px 40px rgba(122, 52, 31, 0.2), 41px 41px rgba(122, 52, 31, 0.18), 42px 42px rgba(121, 53, 32, 0.16), 43px 43px rgba(120, 53, 33, 0.14), 44px 44px rgba(119, 54, 34, 0.12), 45px 45px rgba(119, 54, 34, 0.1), 46px 46px rgba(118, 54, 35, 0.08), 47px 47px rgba(117, 55, 36, 0.06), 48px 48px rgba(116, 55, 37, 0.04), 49px 49px rgba(116, 56, 37, 0.02), 50px 50px rgba(115, 56, 38, 0);
}
</style>
<div class="myBox">Hello CSS</div>
<p>效果如下:<br><br></p>
<style type="text/css">
.myBox {
font-size: 4em;
font-weight: bold;
color: #ff6333;
text-shadow: 0px 0px #992400, 1px 1px rgba(152, 36, 1, 0.98), 2px 2px rgba(151, 37, 2, 0.96), 3px 3px rgba(151, 37, 2, 0.94), 4px 4px rgba(150, 37, 3, 0.92), 5px 5px rgba(149, 38, 4, 0.9), 6px 6px rgba(148, 38, 5, 0.88), 7px 7px rgba(148, 39, 5, 0.86), 8px 8px rgba(147, 39, 6, 0.84), 9px 9px rgba(146, 39, 7, 0.82), 10px 10px rgba(145, 40, 8, 0.8), 11px 11px rgba(145, 40, 8, 0.78), 12px 12px rgba(144, 41, 9, 0.76), 13px 13px rgba(143, 41, 10, 0.74), 14px 14px rgba(142, 41, 11, 0.72), 15px 15px rgba(142, 42, 11, 0.7), 16px 16px rgba(141, 42, 12, 0.68), 17px 17px rgba(140, 43, 13, 0.66), 18px 18px rgba(139, 43, 14, 0.64), 19px 19px rgba(138, 43, 15, 0.62), 20px 20px rgba(138, 44, 15, 0.6), 21px 21px rgba(137, 44, 16, 0.58), 22px 22px rgba(136, 45, 17, 0.56), 23px 23px rgba(135, 45, 18, 0.54), 24px 24px rgba(135, 45, 18, 0.52), 25px 25px rgba(134, 46, 19, 0.5), 26px 26px rgba(133, 46, 20, 0.48), 27px 27px rgba(132, 47, 21, 0.46), 28px 28px rgba(132, 47, 21, 0.44), 29px 29px rgba(131, 48, 22, 0.42), 30px 30px rgba(130, 48, 23, 0.4), 31px 31px rgba(129, 48, 24, 0.38), 32px 32px rgba(129, 49, 24, 0.36), 33px 33px rgba(128, 49, 25, 0.34), 34px 34px rgba(127, 50, 26, 0.32), 35px 35px rgba(126, 50, 27, 0.3), 36px 36px rgba(125, 50, 28, 0.28), 37px 37px rgba(125, 51, 28, 0.26), 38px 38px rgba(124, 51, 29, 0.24), 39px 39px rgba(123, 52, 30, 0.22), 40px 40px rgba(122, 52, 31, 0.2), 41px 41px rgba(122, 52, 31, 0.18), 42px 42px rgba(121, 53, 32, 0.16), 43px 43px rgba(120, 53, 33, 0.14), 44px 44px rgba(119, 54, 34, 0.12), 45px 45px rgba(119, 54, 34, 0.1), 46px 46px rgba(118, 54, 35, 0.08), 47px 47px rgba(117, 55, 36, 0.06), 48px 48px rgba(116, 55, 37, 0.04), 49px 49px rgba(116, 56, 37, 0.02), 50px 50px rgba(115, 56, 38, 0);
}
</style>
<div class="myBox">Hello CSS</div> 黑黑又出了这么多字体效果,这些都可以用在帖子中呢,太棒了{:4_199:} @小辣椒亲爱的快来看,黑黑又出了很多字体效果{:4_187:} 红影 发表于 2022-3-10 10:33
黑黑又出了这么多字体效果,这些都可以用在帖子中呢,太棒了
陆续添加 本帖最后由 马黑黑 于 2022-3-10 11:13 编辑
本例,代码中的字串变量有说明:
<div id="txtBox" style="margin: auto; width: 400px; font-size: 1em;"></div>
<script language="javascript">
var txtBox = document.getElementById("txtBox");
var idx = 0;
var str = "本例主要利用JS的substring()方法截取字符串的第start个到第end个字串,并通过setInterval定时器实现循环不断的逐字上屏功能。";
setInterval(function(){
txtBox.innerHTML = str.substring(0, idx) + "|";
idx += 1;
if(idx > str.length) idx = 0;
}, 200);
</script>
本帖最后由 马黑黑 于 2022-3-10 11:19 编辑 <br /><br /><p>效果:<br><br></p>
<div id="tBox" style="margin: auto; width: 400px; font-size: 1em;"></div>
<script language="javascript">
var txtBox = document.getElementById("tBox");
var txtidx = 0;
var str = "本例主要利用JS的substring()方法截取字符串的第start个到第end个字串,并通过setInterval定时器实现循环不断的逐字上屏功能。";
setInterval(function(){
txtBox.innerHTML = str.substring(0, txtidx) + "|";
txtidx += 1;
if(txtidx > str.length) txtidx = 0;
}, 200);
</script>
阴影立体字:
这个和长阴影立体字实现机制是一样的,只是他的阴影设置的短一些,可能更实用。代码如下:
<style type="text/css">
.yinying {
text-align: center;
font-size: 4em;
font-weight: bold;
color: #006400;
text-shadow:0 -1px 0 #ffffff,0 1px 0 #2e2e2e,0 2px 0 #2c2c2c,0 3px 0 #2a2a2a,0 4px 0 #282828,0 5px 0 #262626,0 6px 0 #242424,0 7px 0 #222222,0 8px 0 #202020,0 9px 0 #1e1e1e,0 10px 0 #1c1c1c,0 11px 0 #1a1a1a,0 12px 0 #181818,0 13px 0 #161616,0 14px 0 #141414,0 15px 0 #121212;
}
</style>
<div class="yinying">歡迎來到花潮論壇!</div>
本帖最后由 马黑黑 于 2022-3-10 13:23 编辑 <br /><br /><style type="text/css">
.yinying {
font-family: 微软雅黑,黑体,宋体;
text-align: center;
font-size: 4em;
font-weight: bold;
color: #006400;
text-shadow:0 -1px 0 #ffffff,0 1px 0 #2e2e2e,0 2px 0 #2c2c2c,0 3px 0 #2a2a2a,0 4px 0 #282828,0 5px 0 #262626,0 6px 0 #242424,0 7px 0 #222222,0 8px 0 #202020,0 9px 0 #1e1e1e,0 10px 0 #1c1c1c,0 11px 0 #1a1a1a,0 12px 0 #181818,0 13px 0 #161616,0 14px 0 #141414,0 15px 0 #121212;
}
</style>
<p>效果:<br><br></p>
<div class="yinying">歡迎來到花潮論壇!</div>
马黑黑 发表于 2022-3-10 11:11
陆续添加
14楼那个更好,真想问你怎样自动循环逐字添加呢{:4_173:} 马黑黑 发表于 2022-3-10 13:19
阴影立体字:
这个和长阴影立体字实现机制是一样的,只是他的阴影设置的短一些,可能更实用。代码如下:
...
这个看起来很立体,颜色的调配还是挺主要的。 红影 发表于 2022-3-10 14:14
14楼那个更好,真想问你怎样自动循环逐字添加呢
代码在十三楼,非常简单的,我只用了 substring() 方法加个定时器。
JS处理文本的功能很强大,看看手册,会找到很多可以实现此类功能的路子 <style type="text/css">
.neiqian {
margin: auto;
width: 600px;
height: 150px;
line-height: 150px;
text-align: center;
color: #202020;
font-size: 4em;
background-color: #2d2d2d;
text-shadow: -1px -1px 1px #111111, 2px 2px 1px #363636;
}
</style>
<p>CSS内嵌字:前景色+背景色营造的视觉效果<br><br></p>
<div class="neiqian">天下誰人不識君</div>