这个textarea我要把它背景色设置为半透明的然后显示一个div里的文字在这个文本框后方:documentquerySelector#keywords-textareaHTML结构是这样的: div class=container div class=keywords button id=pure-multiplier-buttonbutton button id=p
你可以通过CSS来设置textarea的背景色为半透明,然后通过绝对定位把显示文字的div放到textarea的后面。具体代码如下:
CSS代码:
#keywords-textarea { background-color: rgba(255, 255, 255, 0.5); /* 设置背景色为半透明白色 / position: relative; / 设置定位为相对定位,后续绝对定位需要基于此来定位 */ }
#display-text { position: absolute; /* 设置定位为绝对定位 / top: 0; / 距离顶部为0 / left: 0; / 距离左侧为0 / margin-top: 10px; / 上下间距为10px / margin-left: 10px; / 左右间距为10px / z-index: -1; / 把显示文字的div的z-index设置为-1,使其在textarea后面 */ }
HTML代码:
要显示一些文字
原文地址: https://www.cveoy.top/t/topic/fONx 著作权归作者所有。请勿转载和采集!