使用 CSS3 在透明框中设置文本
cssweb developmentfront end technology更新于 2025/11/27 11:24:17
使用 CSS3 在透明框中设置文本,代码如下 −
示例
<!DOCTYPE html>
<html>
<head>
<style>
body {
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
.transparentBox {
background: url("https://i.picsum.photos/id/249/1000/300.jpg") repeat;
border: 2px solid black;
}
.transparentText {
margin: 30px;
background-color: #ffffff;
border: 1px solid black;
opacity: 0.6;
}
.transparentText p {
margin: 5%;
font-weight: bolder;
color: #000000;
font-size: 20px;
}
</style>
</head>
<body>
<h1>Text in transparent box example</h1>
<div class="transparentBox">
<div class="transparentText">
<p>This is some random text inside the transparent box</p>
</div>
</div>
</body>
</html>
输出
上述代码将产生以下输出 −

相关文章
有用资源
css 参考教程 - 该教程包含有关 css 的更多信息:https://www.cainiaomax.com/css/

