制作一个完全透明的文本框。

4

我可以通过以下方式使文本框(部分)的背景和边框透明 -

<textarea id="one" style="background-color: rgba(0, 0, 0, 0); border-color: rgba(0, 0, 0, 0)">
</textarea>

然而,文本区域的右下角仍有一些倾斜的线条是我无法去除的!此外,当文本区域处于焦点状态时,边框会重新出现。如何使文本区域完全透明?

2个回答

5

将resize属性设置为none

<textarea id="one" style="resize: none;background-color: rgba(0, 0, 0, 0); border-color: rgba(0, 0, 0, 0)">
</textarea>

此外,当焦点在元素上时,需要使用 outline: none 来移除边框。 - SerVB

1
#one {
background: none;  // no bg means already transparent if no color wanted
border: none; // no border  , but if exist add !important to style
}

你只需要将边框和背景设置为none,而不是使用rgba(0, 0, 0, 0)。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接