Pure CSS Customizing Buttons - GeeksforGeeks
Có thể bạn quan tâm
Pure CSS is a CSS framework. It is a set of free and open-source tools for building responsive websites and web applications. Yahoo developed this, which is used to make websites that are quicker, more elegant, and more responsive. It can be used as an alternative to Bootstrap.
The Customizing Buttons facilitates customizing the button styles such as color, shape, size, and icons, by grouping the custom CSS into a class, that helps to implement it to an element containing the class name.
Pure CSS Customizing Buttons Class:
- pure-button: The pure-button class is used to create a pure button with normal & regular-size buttons.
- button-xsmall: This class is used to create extra small buttons.
- button-small: This class is used to create small buttons.
- button-large: This class is used to create large buttons.
- button-xlarge: This class is used to create extra-large buttons.
Syntax:
<button class="Customizing Buttons Class"> Content </button>Example1: In this example, we will demonstrate Pure CSS Customizing Colored Buttons.
HTML
<!DOCTYPE html> <html> <head> <link rel="stylesheet" href= "https://unpkg.com/purecss@1.0.0/build/pure-min.css" integrity= "sha384-nn4HPE8lTHyVtfCBi5yW9d20FjT8BJwUXyWZT9InLYax14RDjBj46LmSztkmNP9w" crossorigin="anonymous" /> <style> .button-success { background: rgb(27, 240, 76); } .button-error { background: rgb(252, 16, 16); } .button-warning { background: rgb(245, 128, 18); } .button-download { background: rgb(66, 184, 221); } </style> </head> <body style="text-align: center"> <h2 style="color:green">GeeksforGeeks</h2> <strong>Pure CSS Customizing Coloured Buttons </strong> <br /> <button class="button-success pure-button"> Success Button </button> <button class="button-warning pure-button"> Warning Button </button> <button class="button-download pure-button"> Download Button </button> <button class="button-error pure-button"> Error Button </button> </body> </html> |
Output:
Example 2: In this example, we will demonstrate Pure CSS Customizing Colored Buttons with rounded corners.
HTML
<!DOCTYPE html> <html> <head> <title>Pure CSS Customizing Buttons</title> <link rel="stylesheet" href= "https://unpkg.com/purecss@1.0.0/build/pure-min.css" integrity= "sha384-nn4HPE8lTHyVtfCBi5yW9d20FjT8BJwUXyWZT9InLYax14RDjBj46LmSztkmNP9w" crossorigin="anonymous" /> <style> .button-success, .button-error, .button-warning, .button-download { color: white; border-radius: 15px; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); } .button-success { background: rgb(27, 240, 76); } .button-error { background: rgb(252, 16, 16); } .button-warning { background: rgb(245, 128, 18); } .button-download { background: rgb(66, 184, 221); } </style> </head> <body style="text-align: center"> <h2 style="color:green">GeeksforGeeks</h2> <strong> Pure CSS Customizing Coloured Buttons with rounded corner </strong> <br /> <br /> <button class="button-success pure-button"> Success Button </button> <button class="button-warning pure-button"> Warning Button </button> <button class="button-download pure-button"> Download Button </button> <button class="button-error pure-button"> Error Button </button> </body> </html> |
Output:
Example 3: In this example, we will demonstrate Pure CSS Customizing Buttons with different button sizes.
HTML
<!DOCTYPE html> <html> <head> <title>Pure CSS Customizing Buttons</title> <link rel="stylesheet" href= "https://unpkg.com/purecss@1.0.0/build/pure-min.css" integrity= "sha384-nn4HPE8lTHyVtfCBi5yW9d20FjT8BJwUXyWZT9InLYax14RDjBj46LmSztkmNP9w" crossorigin="anonymous" /> <style scoped=""> .button-xsmall { font-size: 70%; } .button-small { font-size: 85%; } .button-large { font-size: 110%; } .button-xlarge { font-size: 125%; } </style> </head> <body style="text-align: center"> <h2 style="color:green">GeeksforGeeks</h2> <strong> Pure CSS Customizing Buttons with different sizes </strong> <br /> <br /> <button class="button-xsmall pure-button"> Extra Small Button </button> <button class="button-small pure-button"> Small Button </button> <button class="pure-button"> Regular Button </button> <button class="button-large pure-button"> Large Button </button> <button class="button-xlarge pure-button"> Extra Large Button </button> </body> </html> |
Output:
Example 4: In this example, we will demonstrate Pure Customizing CSS Buttons with button icons.
HTML
<!DOCTYPE html> <html> <head> <title>Pure CSS Customizing Buttons</title> <link rel="stylesheet" href= "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <link rel="stylesheet" href= "https://unpkg.com/purecss@1.0.0/build/pure-min.css" integrity= "sha384-nn4HPE8lTHyVtfCBi5yW9d20FjT8BJwUXyWZT9InLYax14RDjBj46LmSztkmNP9w" crossorigin="anonymous" /> </head> <body style="text-align: center"> <h2 style="color:green">GeeksforGeeks</h2> <strong>Pure CSS Customizing Buttons with icons</strong> <br /> <button class="pure-button" href="#"> <i class="fa fa-github" aria-hidden="true"></i>github </button> <button class="pure-button" href="#"> <i class="fa fa-bluetooth" aria-hidden="true"></i>bluetooth </button> <button class="pure-button" href="#"> <i class="fa fa-home" aria-hidden="true"></i>home </button> </body> </html> |
Output:
Reference: https://purecss.io/buttons/#customizing-buttons
sahilsulakhe3 Follow Improve Previous Article Pure CSS Primary Buttons Next Article Pure CSS Colored buttons with rounded cornersPlease Login to comment...
Từ khóa » Html Cool Button Css
-
55 Cool CSS Buttons - With Animations! - WebDEasy
-
Cool And Responsive Buttons With A Few Lines Of CSS
-
154 CSS Buttons - Free Frontend
-
CSS Buttons - W3Schools
-
88 Beautiful CSS Buttons Examples - CSS Scan
-
20 Amazing Pure CSS Animated Buttons - 1stWebDesigner
-
50 Cool CSS Buttons For Endless Design Inspirations - WebTopic
-
10 Cool Button Designs Using CSS3 (Without Using JavaScript)
-
Top 50 CSS Buttons (+ Animations) - DEV Community
-
50 CSS3 Button Tutorials For Designers - Hongkiat
-
The Best CSS Button Hover Effects You Can Use Too
-
Copy & Paste CSS - Buttons Design
-
CSS Button Style – Hover, Color, And Background - FreeCodeCamp
-
CSS Button Generator: Create HTML And CSS Button Styles