我有一个带框阴影的蓝色框,文字颜色为白色,如下所示:
是否可以添加内部阴影? 像this(jsfiddle)?它不适用于文本颜色白色,就像我的例子。
body {
/* This has to be same as the text-shadows below */
background: #def;
}
h1 {
font-family: Helvetica, Arial, sans-serif;
font-weight: bold;
font-size: 6em;
line-height: 1em;
}
.inset-text {
/* Shadows are visible under slightly transparent text color */
color: rgba(10, 60, 150, 0.8);
text-shadow: 1px 4px 6px #def, 0 0 0 #000, 1px 4px 6px #def;
}
/* Don't show shadows when selecting text */
::-moz-selection {
background: #5af;
color: #fff;
text-shadow: none;
}
::selection {
background: #5af;
color: #fff;
text-shadow: none;
}
<h1 class="inset-text">Inset text-shadow trick</h1>
答案 0 :(得分:0)
请您检查一下是否符合要求?
body {
/* This has to be same as the text-shadows below */
background: #006db1;
}
h1 {
font-family: Helvetica, Arial, sans-serif;
font-weight: bold;
font-size: 6em;
line-height: 1em;
}
.inset-text {
/* Shadows are visible under slightly transparent text color */
color: rgba(255, 255, 255, 0.8);
text-shadow: 1px 4px 6px #555, 0 0 0 #ddd, 1px 4px 6px #000;
}
/* Don't show shadows when selecting text */
::-moz-selection { background: #fff; color: #000; text-shadow: none; }
::selection { background: #fff; color: #000; text-shadow: none; }
答案 1 :(得分:0)
在您的演示中,如果您希望innerShaow
为白色文字。
只需设置color: rgba(255,255,255, 0.8);
即可看到内部阴影。
body {
/* This has to be same as the text-shadows below */
background: #277ac0;
}
h1 {
font-family: Helvetica, Arial, sans-serif;
font-weight: bold;
font-size: 6em;
line-height: 1em;
}
.inset-text {
background-color: #565656;
color: transparent;
text-shadow: 0px 2px 3px rgba(255,255,255,1);
-webkit-background-clip: text;
-moz-background-clip: text;
background-clip: text;
}
/* Don't show shadows when selecting text */
::-moz-selection {
background: #5af;
color: #fff;
text-shadow: none;
}
::selection {
background: #5af;
color: #fff;
text-shadow: none;
}
&#13;
<h1 class="inset-text">Inset text-shadow trick</h1>
&#13;