HTML   发布时间:2022-04-14  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了html – css按钮文本和按钮背景不同的不透明度大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
希望你可以帮助解决一个关于CSS的简单问题.我正在尝试使用透明背景和带有与按钮不具有相同不透明度的文本的轮廓来创建一个按钮(不需要是html类按钮).也就是说,文本应保持与按钮不同的不透明度.这可能吗?

我试图在这里解决这个问题 – http://jsfiddle.net/9jXYt/

CSS:

#xxx {
  outline:white solid 0.5px;
  /*opacity: 0.2; */
  BACkground-color: rgba(255,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.5) !important;
}@H_618_7@ 
 

HTML:
< button id =“xxx”>< div id =“fff”>这是一个测试< / div>< / button>

提前感谢任何提示.

解决方法

不透明度由子项继承,不能反转,因此在父项上也使用rgba.例如.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>

#xxx {
  outline:white solid 0.5px;
  padding: 6px 8px;
  border-radius: 3px;
  color:rgba(0,0.4);
  font-weight: bold;
  border: none;
  margin: 0;
  BACkground: rgba(0,0.2);
  font-family: Helvetica,sans-serif;
  font-size: 19pt;
}

#xxx:hover {
   BACkground: rgba(0,0.4); 
   color:rgba(0,0.8);
}
</style>
</head>
<body>

<button id="xxx">This is a test</button>

</body>
</html>@H_618_7@

大佬总结

以上是大佬教程为你收集整理的html – css按钮文本和按钮背景不同的不透明度全部内容,希望文章能够帮你解决html – css按钮文本和按钮背景不同的不透明度所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。