源代码:
下载代码
AI 编程工具
点击运行
<!DOCTYPE html> <html> <head> <title>Bootstrap5 实例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="https://cdn.staticfile.net/twitter-bootstrap/5.1.1/css/bootstrap.min.css" rel="stylesheet"> <script src="https://cdn.staticfile.net/twitter-bootstrap/5.1.1/js/bootstrap.bundle.min.js"></script> </head> <body> <div class="container mt-3"> <h2>文本颜色透明度</h2> <p>可以设置文本颜色透明度为 50% ,使用 .text-black-50 或 .text-white-50 类:</p> <p class="text-black-50">透明度为 50% 的黑色文本,背景为白色。</p> <p class="text-white-50 bg-dark">透明度为 50% 的白色文本,背景为黑色。</p> </div> </body> </html>
运行结果: