How to Create a Transparent button using HTML and CSS ?
The transparent button can be easily created by using HTML and CSS. In this article, we will use background-color: transparent; property to design the transparent background button.
HTML Code: In this section, we will create a basic structure of button using the button Tag.
<!DOCTYPE html><html lang="en"> <head> <meta charset="utf-8"> <title> Create a Transparent button using HTML and CSS </title></head> <body> <h1>GeeksforGeeks</h1> <h3> Create a Transparent button using HTML and CSS </h3> <button class="btn">Click me!</button></body> </html> |
CSS Code: In this section, we will design the button using CSS property. We will use the background-color: transparent; property to set the button with transparent look.
<style> body { margin: 0; padding: 0; text-align: center; } h1 { color: green; } /* Styling the button */ .btn { cursor: pointer; border: 1px solid #3498db; background-color: transparent; height: 50px; width: 200px; color: #3498db; font-size: 1.5em; box-shadow: 0 6px 6px rgba(0, 0, 0, 0.6); }</style> |
Complete Code: In this section, we will combine the above two sections to create a transparent background button.
<!DOCTYPE html><html lang="en"> <head> <meta charset="utf-8"> <title></title> <style> body { margin: 0; padding: 0; text-align: center; } h1 { color: green; } /* Styling the button */ .btn { cursor: pointer; border: 1px solid #3498db; background-color: transparent; height: 50px; width: 200px; color: #3498db; font-size: 1.5em; box-shadow: 0 6px 6px rgba(0, 0, 0, 0.6); } </style></head> <body> <h1>GeeksforGeeks</h1> <h3> Create a Transparent button using HTML and CSS </h3> <button class="btn">Click me!</button></body> </html> |
Output:


