text-stroke和text-fill-color的理解

本文介绍了CSS中text-fill-color和text-stroke属性的用法,包括如何设置文字填充颜色和文字描边,以及这两种效果同时使用时的表现。注意这些特性在不同浏览器中的支持情况。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

text-fill-color是文字填充颜色的意思,text-stroke是文字描边的意思。这两个文字效果IE都不支持,webkit是支持的。

text-fill-color:颜色;


这里是文字填充颜色。


在text-fill-color和color同时存在的时候,color不起作用

此时字体仍然为红色

text-stoke:大小,颜色;


以上两种属性同时使用,效果更炫!

<svg width="800" height="700" viewBox="0 0 800 700" xmlns="http://www.w3.org/2000/svg"> <!-- 背景 --> <rect width="800" height="700" fill="#f9f9f9"/> <!-- 标题 --> <text x="400" y="40" font-family="Arial" font-size="24" text-anchor="middle" font-weight="bold">层次分析法(AHP)一致性矩阵算法流程图</text> <!-- 流程框样式 --> <defs> <marker id="arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto"> <polygon points="0 0, 10 3.5, 0 7" fill="#333"/> </marker> <!-- 渐变定义 --> <linearGradient id="startGradient" x1="0%" y1="0%" x2="100%" y2="0%"> <stop offset="0%" stop-color="#4CAF50"/> <stop offset="100%" stop-color="#388E3C"/> </linearGradient> <linearGradient id="processGradient" x1="0%" y1="0%" x2="100%" y2="0%"> <stop offset="0%" stop-color="#2196F3"/> <stop offset="100%" stop-color="#1976D2"/> </linearGradient> <linearGradient id="calcGradient" x1="0%" y1="0%" x2="100%" y2="0%"> <stop offset="0%" stop-color="#9C27B0"/> <stop offset="100%" stop-color="#7B1FA2"/> </linearGradient> <linearGradient id="resultGradient" x1="0%" y1="0%" x2="100%" y2="0%"> <stop offset="0%" stop-color="#26A69A"/> <stop offset="100%" stop-color="#009688"/> </linearGradient> </defs> <!-- 开始 --> <rect x="350" y="80" width="100" height="40" rx="20" fill="url(#startGradient)" stroke="#388E3C" stroke-width="2"/> <text x="400" y="105" font-family="Arial" font-size="14" text-anchor="middle" fill="white">开始</text> <!-- 设置参数 --> <rect x="350" y="150" width="100" height="40" fill="url(#processGradient)" stroke="#1976D2" stroke-width="2"/> <text x="400" y="175" font-family="Arial" font-size="14" text-anchor="middle" fill="white">设置n=6</text> <!-- 构建矩阵 --> <rect x="300" y="220" width="200" height="60" fill="url(#processGradient)" stroke="#1976D2" stroke-width="2"/> <text x="400" y="245" font-family="Arial" font-size="14" text-anchor="middle" fill="white">构建一致性矩阵</text> <text x="400" y="265" font-family="Arial" font-size="12" text-anchor="middle" fill="white">C(i,j)=9^((i-j)/(n-1))</text> <!-- 计算特征值 --> <rect x="350" y="310" width="100" height="40" fill="url(#calcGradient)" stroke="#7B1FA2" stroke-width="2"/> <text x="400" y="335" font-family="Arial" font-size="14" text-anchor="middle" fill="white">计算特征值特征向量</text> <!-- 提取最大特征值 --> <rect x="350" y="380" width="100" height="40" fill="url(#calcGradient)" stroke="#7B1FA2" stroke-width="2"/> <text x="400" y="405" font-family="Arial" font-size="14" text-anchor="middle" fill="white">提取最大特征值λ_max</text> <!-- 计算CI --> <rect x="350" y="450" width="100" height="40" fill="url(#calcGradient)" stroke="#7B1FA2" stroke-width="2"/> <text x="400" y="475" font-family="Arial" font-size="14" text-anchor="middle" fill="white">计算CI=(λ_max-n)/(n-1)</text> <!-- 计算CR --> <rect x="350" y="520" width="100" height="40" fill="url(#calcGradient)" stroke="#7B1FA2" stroke-width="2"/> <text x="400" y="545" font-family="Arial" font-size="14" text-anchor="middle" fill="white">计算CR=CI/RI</text> <!-- 判断一致性 --> <rect x="350" y="590" width="100" height="40" fill="url(#resultGradient)" stroke="#009688" stroke-width="2"/> <text x="400" y="615" font-family="Arial" font-size="14" text-anchor="middle" fill="white">CR<0.1? 是/否</text> <!-- 决策结果 --> <rect x="200" y="660" width="400" height="30" rx="15" fill="#FFC107" stroke="#FFA000" stroke-width="2"/> <text x="400" y="680" font-family="Arial" font-size="14" text-anchor="middle" fill="#333">一致性可接受 → 使用计算权重</text> <rect x="200" y="695" width="400" height="30" rx="15" fill="#FF5722" stroke="#E64A19" stroke-width="2"/> <text x="400" y="715" font-family="Arial" font-size="14" text-anchor="middle" fill="white">一致性不可接受 → 重新调整判断矩阵</text> <!-- 连接线 --> <line x1="400" y1="120" x2="400" y2="150" stroke="#333" stroke-width="2" marker-end="url(#arrowhead)"/> <line x1="400" y1="190" x2="400" y2="220" stroke="#333" stroke-width="2" marker-end="url(#arrowhead)"/> <line x1="400" y1="280" x2="400" y2="310" stroke="#333" stroke-width="2" marker-end="url(#arrowhead)"/> <line x1="400" y1="360" x2="400" y2="380" stroke="#333" stroke-width="2" marker-end="url(#arrowhead)"/> <line x1="400" y1="430" x2="400" y2="450" stroke="#333" stroke-width="2" marker-end="url(#arrowhead)"/> <line x1="400" y1="500" x2="400" y2="520" stroke="#333" stroke-width="2" marker-end="url(#arrowhead)"/> <line x1="400" y1="570" x2="400" y2="590" stroke="#333" stroke-width="2" marker-end="url(#arrowhead)"/> <!-- 决策结果连接线 --> <line x1="300" y1="620" x2="200" y2="645" stroke="#333" stroke-width="2" marker-end="url(#arrowhead)" stroke-dasharray="5,5"/> <line x1="500" y1="620" x2="600" y2="645" stroke="#333" stroke-width="2" marker-end="url(#arrowhead)" stroke-dasharray="5,5"/> <!-- 算法细节说明 --> <text x="20" y="180" font-family="Arial" font-size="12" fill="#333">1. 设置影响因素数量n=6</text> <text x="20" y="210" font-family="Arial" font-size="12" fill="#333">2. 构建6×6一致性矩阵</text> <text x="20" y="240" font-family="Arial" font-size="12" fill="#333">3. 计算矩阵的特征值特征向量</text> <text x="20" y="270" font-family="Arial" font-size="12" fill="#333">4. 提取最大特征值λ_max</text> <text x="20" y="300" font-family="Arial" font-size="12" fill="#333">5. 计算一致性指标CI</text> <text x="20" y="330" font-family="Arial" font-size="12" fill="#333">6. 查表获取RI值(RI[6]=1.24)</text> <text x="20" y="360" font-family="Arial" font-size="12" fill="#333">7. 计算一致性比率CR</text> <text x="20" y="390" font-family="Arial" font-size="12" fill="#333">8. 判断CR是否小于0.1</text> <text x="20" y="420" font-family="Arial" font-size="12" fill="#333">9. 根据一致性结果进行决策</text> </svg> 生成此图
05-17
<svg xmlns="http://www.w3.org/2000/svg" width="720" height="600" font-family="Arial, sans-serif"> <!-- 标题栏 --> <rect x="10" y="10" width="650" height="40" fill="#4a90e2" rx="5"/> <text x="360" y="35" font-size="18" fill="#fff" text-anchor="middle" dominant-baseline="middle">UBIFS 磨损均衡原理</text> <!-- 初始状态 --> <g transform="translate(60, 70)"> <rect x="0" y="0" width="220" height="150" fill="#f0f8ff" stroke="#000" stroke-width="1" rx="5"/> <text x="100" y="20" font-size="14" text-anchor="middle">初始状态</text> <rect x="10" y="50" width="60" height="40" fill="#e6f7ff" stroke="#000" stroke-width="1"/> <text x="40" y="70" font-size="12" text-anchor="middle">PEB 0</text> <text x="40" y="85" font-size="10" fill="#333" text-anchor="middle">擦除次数: 10</text> <rect x="80" y="50" width="60" height="40" fill="#e6f7ff" stroke="#000" stroke-width="1"/> <text x="110" y="70" font-size="12" text-anchor="middle">PEB 1</text> <text x="110" y="85" font-size="10" fill="#333" text-anchor="middle">擦除次数: 5</text> <rect x="150" y="50" width="60" height="40" fill="#e6f7ff" stroke="#000" stroke-width="1"/> <text x="180" y="70" font-size="12" text-anchor="middle">PEB 2</text> <text x="180" y="85" font-size="10" fill="#333" text-anchor="middle">擦除次数: 8</text> </g> <!-- 写入操作 --> <g transform="translate(60, 240)"> <rect x="0" y="0" width="220" height="150" fill="#f0f8ff" stroke="#000" stroke-width="1" rx="5"/> <text x="100" y="20" font-size="14" text-anchor="middle">写入操作</text> <rect x="10" y="50" width="60" height="40" fill="#e6f7ff" stroke="#000" stroke-width="1"/> <text x="40" y="70" font-size="12" text-anchor="middle">PEB 0</text> <text x="40" y="85" font-size="10" fill="#333" text-anchor="middle">擦除次数: 10</text> <rect x="80" y="50" width="60" height="40" fill="#e6f7ff" stroke="#000" stroke-width="1"/> <text x="110" y="70" font-size="12" text-anchor="middle">PEB 1</text> <text x="110" y="85" font-size="10" fill="#333" text-anchor="middle">擦除次数: 6</text> <rect x="150" y="50" width="60" height="40" fill="#e6f7ff" stroke="#000" stroke-width="1"/> <text x="180" y="70" font-size="12" text-anchor="middle">PEB 2</text> <text x="180" y="85" font-size="10" fill="#333" text-anchor="middle">擦除次数: 8</text> <line x1="110" y1="130" x2="110" y2="90" stroke="#000" stroke-width="1" marker-end="url(#arrow)"/> <text x="110" y="145" font-size="12" text-anchor="middle">写入</text> </g> <!-- 垃圾回收 --> <g transform="translate(360, 240)"> <rect x="0" y="0" width="220" height="150" fill="#f0f8ff" stroke="#000" stroke-width="1" rx="5"/> <text x="100" y="20" font-size="14" text-anchor="middle">垃圾回收</text> <rect x="10" y="50" width="60" height="40" fill="#e6f7ff" stroke="#000" stroke-width="1"/> <text x="40" y="70" font-size="12" text-anchor="middle">PEB 0</text> <text x="40" y="85" font-size="10" fill="#333" text-anchor="middle">擦除次数: 10</text> <rect x="80" y="50" width="60" height="40" fill="#e6f7ff" stroke="#000" stroke-width="1"/> <text x="110" y="70" font-size="12" text-anchor="middle">PEB 1</text> <text x="110" y="85" font-size="10" fill="#333" text-anchor="middle">擦除次数: 6</text> <rect x="150" y="50" width="60" height="40" fill="#e6f7ff" stroke="#000" stroke-width="1"/> <text x="180" y="70" font-size="12" text-anchor="middle">PEB 2</text> <text x="180" y="85" font-size="10" fill="#333" text-anchor="middle">擦除次数: 9</text> <line x1="110" y1="170" x2="110" y2="90" stroke="#000" stroke-width="1" marker-end="url(#arrow)"/> <text x="110" y="185" font-size="12" text-anchor="middle">擦除 PEB 1</text> </g> <!-- 分隔线 --> <line x1="60" y1="230" x2="650" y2="230" stroke="#888" stroke-dasharray="4"/> <!-- 图例说明 --> <foreignObject x="60" y="450" width="600" height="180"> <div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, sans-serif; font-size:14px; color:#000;"> <ul style="list-style: none; padding: 0; margin: 0;"> <li><span style="display:inline-block;width:12px;height:12px;background:#e6f7ff; border:1px solid #000;margin-right:5px;"></span> 物理擦除块 (PEB)</li> <li><span style="display:inline-block;width:12px;height:12px;background:#f0f8ff; border:1px solid #000;margin-right:5px;"></span> 逻辑擦除块 (LEB)</li> </ul> <p style="margin-top:10px;">UBIFS 通过动态映射将 LEB 映射到 PEB,确保数据在不同的 PEB 之间均匀分布。</p> <p>当一个 PEB 写满后,UBIFS 会选择新的 PEB 进行写操作,并将旧 PEB 标记为可回收。</p> <p>垃圾回收过程中,UBIFS 将有效数据复制到新的 PEB,并擦除旧 PEB,实现磨损均衡。</p> </div> </foreignObject> <!-- 箭头定义 --> <defs> <marker id="arrow" markerWidth="10" markerHeight="10" refX="5" refY="3" orient="auto"> <path d="M0,0 L0,6 L9,3 z" fill="#000"/> </marker> </defs> </svg> 这个代码写的对不对?
最新发布
06-19
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值