实现思路: 给button 元素设置了透明,将button里面的文字放到span标签,设置一个颜色,文字就不会透明
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>css3的rgba</title> <style> *{ padding: 0; margin: 0; } .btn{ width :120px; height: 40px; border:none; background-color :rgba(225,225,225,0.4); } .btn span{ color: black; cursor pointer } </style> </head> <body> <button class="btn"> <span>不透明</span> </button> </html>