


Example analysis of how to make button buttons change color using css
First, let’s take a look at the final rendering:
This is our best goal. If you are interested, fine, then keep reading.
First of all, this button uses the new style attributes of css3.0. If your browser does not see the corner arc style, it means that your browser version does not support the new style of CSS3.0. The solution is to upgrade your browser to the latest one. As far as I know, XP and Windows Server 2003 support up to IE8 (you can see the effect). If you don’t want to upgrade IE, you have to download a browser that is not IE-based, such as Firefox, Google, Opera, etc.
Okay with all the nonsense ahead, let’s take a look at how to make our beautiful buttons.
In fact, we use the CSS pseudo-element here, hover.
First we must put an input type button on the page. Add css style to this button button.
The specific css code is as follows:
.mybtn { width:86px; text-align:center; line-height:100%; padding-top:0.5em; padding-right:2em; padding-bottom:0.55em; padding-left:2em; font-family:Arial,sans-serif; font-size:14px; font-style:normal; font-variant:normal; font-weight:normal; text-decoration:none; margin-top:0px; margin-right:2px; margin-bottom:0px; margin-left:2px; vertical-align:text-bottom; display:inline-block; cursor:pointer; zoom:1; outline-width:medium; outline-color:invert; font-size-adjust:none; font-stretch:normal; border-top-left-radius:0.5em; border-top-right-radius:0.5em; border-bottom-left-radius:0.5em; border-bottom-right-radius:0.5em; box-shadow:0px 1px 2px rgba(0,0,0,0.2); text-shadow:0px 1px 1px rgba(0,0,0,0.3); color:#fefee9; border-top-color:#da7c0c; border-right-color:#da7c0c; border-bottom-color:#da7c0c; border-left-color:#da7c0c; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; background-image:none; background-attachment:scroll; background-repeat:repeat; background-position-x:0%; background-position-y:0%; background-size:auto; background-origin:padding-box; background-clip:padding-box; background-color:#f78d1d; }
For specific css style explanation, please go to Baidu, which can improve your css level. If you don't know CSS skills but want to use this effect, what you need to modify is the width of the button and set it to the appropriate width of your button. Another thing is to replace the background color.
After writing the css style and the input button button, we should associate them. We only need to add the class to the input button.
<input type="button" class="mybtn" value="我是按钮" />
Now we have the last step, which is to use the pseudo-element hover of css,
to write a mybtn hover style. The code is as follows:
.mybtn:hover { background: #f47c20; }
Because we only need to modify the background color when we move the mouse up, we only need to modify one attribute in the hover style.
The above is the detailed content of Example analysis of how to make button buttons change color using css. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Using Bootstrap in Vue.js is divided into five steps: Install Bootstrap. Import Bootstrap in main.js. Use the Bootstrap component directly in the template. Optional: Custom style. Optional: Use plug-ins.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.

There are two ways to create a Bootstrap split line: using the tag, which creates a horizontal split line. Use the CSS border property to create custom style split lines.

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-

How to use the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text
