小编Tar*_*nko的帖子

如何使用 CurrentColor 设置边框的不透明度?

我自定义链接。我希望边框颜色取决于color。为此,我使用 CurrentColor。

\n\n

如何使不透明度为0.5的边框底部

\n\n

\r\n
\r\n
a {\r\n  text-decoration: none;\r\n  color: blue;\r\n  border-bottom: 1px solid CurrentColor;\r\n}
Run Code Online (Sandbox Code Playgroud)\r\n
<a href="/">Some link</a>
Run Code Online (Sandbox Code Playgroud)\r\n
\r\n
\r\n

\n\n

我有一个解决方案,但我不确定它是最好的。

\n\n

\r\n
\r\n
a {\r\n  text-decoration: none;\r\n  color: blue;\r\n  background: linear-gradient(to bottom, CurrentColor, transparent 50%) 0 100% repeat-x;\r\n  background-size: 10px 1px;\r\n}
Run Code Online (Sandbox Code Playgroud)\r\n
<a href="/">Some link</a>
Run Code Online (Sandbox Code Playgroud)\r\n
\r\n
\r\n

\n\n

此解决方案不起作用\xe2\x80\x99。

\n\n

\r\n
\r\n
a {\r\n  --color: blue;\r\n  \r\n  text-decoration: none;\r\n  color: var(blue);\r\n  border-bottom: 1px solid rgba(var(--color), 0.5);\r\n}
Run Code Online (Sandbox Code Playgroud)\r\n …

css border opacity css-variables

3
推荐指数
1
解决办法
4937
查看次数

圈子样式背景

我知道制作虚线背景图案是多么容易.

body {
  background: linear-gradient(90deg, #eee 30px, transparent 1%) center, 
    linear-gradient(#eee 30px, transparent 1%) center, #444;
  background-size: 34px 34px;
}
Run Code Online (Sandbox Code Playgroud)

请告诉我圈子而不是方块有多容易?

? ? ?   ? ? ?
? ? ? ? ? ? ?
? ? ?   ? ? ?
Run Code Online (Sandbox Code Playgroud)

css background linear-gradients css3

2
推荐指数
1
解决办法
261
查看次数