【发布时间】:2014-02-26 00:16:17
【问题描述】:
希望您能帮助解答一个关于 CSS 的简单问题。我正在尝试制作一个具有透明背景的按钮(不需要是 html 类按钮)和一个带有与按钮不透明度相同的文本的轮廓。也就是说,文本应保持与按钮不同的不透明度。这可能吗?
我在这里尝试解决这个问题 - http://jsfiddle.net/9jXYt/
CSS:
#xxx {
outline:white solid 0.5px;
/*opacity: 0.2; */
background-color: rgba(255,0,0,0.2);
padding: 6px 8px;
border-radius: 3px;
color: black;
font-weight: bold;
border: none;
margin: 0;
/*box-shadow: 0px 2px 3px #444;*/
}
#xxx:hover {
opacity: 0.9;
}
#fff {
font-family: helvetica, arial, sans-serif;
font-size: 19pt;
opacity: 1 !important;
color: rgba(0,0,0,0.5) !important;
}
HTML:
<button id="xxx"><div id="fff">This is a test</div></button>
提前感谢您的任何提示。
【问题讨论】: