search
HomeWeb Front-endH5 TutorialImplementation of html5 and css3 dynamic bubble button

We are creating a useful set of animated buttons with the power of multiple backgrounds and animations in CSS3, without using JavaScript, with this button pack you can easily turn anything on your web page into an animated button The link just specifies a class name, friends who need it can refer to

This time, we are creating a useful setting to animate buttons with the power of multiple backgrounds and animations of CSS3. With this button pack you can easily turn any link on your web page into an animated button by just specifying a class name. No JavaScript necessary. Four color themes and three sizes are also available by assigning additional class names.
To turn a regular link on a web page into a fancy animated CSS3 button, you just need to specify the button class and one of the supported colors. See some examples below:

<a>Download</a> 
<a>Submit</a> 
<a>Submit</a>

There are four color classes – blue, green, orange and gray. The rest of the classes you see assigned to the link above are optional. You can choose from small, medium, and large sizes, and one category – Rounded, which creates a more rounded version of the button.
Effect Demonstration
It is recommended to use standard browsers such as Chrome and Firefox to view the effect. Even IE 9 has some incompatibilities.

The CSS code for all animated buttons resides in buttons.css. This makes it easy to drop into an existing project and use it.
Please note that throughout the code below, I have defined two versions of the same property in some places. This has to do with the way browsers handle CSS definitions. They parse the rules one by one and apply them, ignoring what they don't understand. This way we can have an understanding of all the rules, which is the normal version, and a CSS3 enabled one that will ignore the old ones.
The first thing we need to do is define the button class. This is the backbone of the button as it applies positioning, fonts and background styles.
The first is the style related to the font, after which the properties are displayed as follows. It is set up as an inline-block, which allows it to sit on the same line as the text around it (like an inline element), but also like an aspect block with padding and margins.
At one point you will see that each button has four background images applied to it. While this sounds scary, only one file is actually requested from the server. The first two backgrounds, the lower left and upper right sections are bubble images, which you can see in the illustration below, and the other two are pure CSS gradients.
As I mentioned above, the background of the bubble is displayed as two separate images, offset by the background position property. Using the CSS3 transition property, we defined animations that would have both versions of the background image at the top or bottom of the slide, creating a bubble effect when you see the button hovered.

/* BlueButton */ 
.blue.button{ 
color:#0f4b6d !important; 
border:1px solid #84acc3 !important; 
/* A fallback background color */ 
background-color: #48b5f2; 
/* Specifying a version with gradients according to */ 
background-image: url('button_bg.png'), url('button_bg.png'), 
-moz-radial-gradient( center bottom, circle, 
rgba(89,208,244,1) 0,rgba(89,208,244,0) 100px), 
-moz-linear-gradient(#4fbbf7, #3faeeb); 
background-image: url('button_bg.png'), url('button_bg.png'), 
-webkit-gradient( radial, 50% 100%, 0, 50% 100%, 100, 
from(rgba(89,208,244,1)), to(rgba(89,208,244,0))), 
-webkit-gradient(linear, 0% 0%, 0% 100%, from(#4fbbf7), to(#3faeeb)); 
} 
.blue.button:hover{ 
background-color:#63c7fe; 
background-image: url('button_bg.png'), url('button_bg.png'), 
-moz-radial-gradient( center bottom, circle, 
rgba(109,217,250,1) 0,rgba(109,217,250,0) 100px), 
-moz-linear-gradient(#63c7fe, #58bef7); 
background-image: url('button_bg.png'), url('button_bg.png'), 
-webkit-gradient( radial, 50% 100%, 0, 50% 100%, 100, 
from(rgba(109,217,250,1)), to(rgba(109,217,250,0))), 
-webkit-gradient(linear, 0% 0%, 0% 100%, from(#63c7fe), to(#58bef7)); 
}

Each color class defines a unique set of unique properties – the color of the button’s text label, text shadow and background image. Notice that we used the Background property button to add multiple images. They are the top of the hierarchy, appearing first and being defined above.
Only Mozilla and Webkit browsers currently support CSS gradients, but with completely different syntax. The remaining browsers will display the fallback background color. You may have noticed that we did not include a prefix for the free version of the gradient rules. This is due to the fact that gradients are not officially part of a CSS specification yet, and there is no preferred syntax protocol.
In the snippet above, you can see that we defined a linear gradient and a radial one above it. To make the gradient blend more smoothly with WebKit and Mozilla syntax, we define one of the RGBA radials, which makes the outer color of the gradient completely transparent.
With this, our CSS3 animated bubble button is complete!
Summary
These buttons are completely based on CSS and integration is very simple – just drop the buttons folder somewhere in your project. By modifying CSS files, you can create your own colors and shapes.

The above is the entire content of this article. I hope it will be helpful to everyone's study. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

H5 implements the function code of uploading local images and being able to preview them

How to set up CSS Text font color

The above is the detailed content of Implementation of html5 and css3 dynamic bubble button. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
H5: The Future of Web Content and DesignH5: The Future of Web Content and DesignMay 01, 2025 am 12:12 AM

H5 (HTML5) will improve web content and design through new elements and APIs. 1) H5 enhances semantic tagging and multimedia support. 2) It introduces Canvas and SVG, enriching web design. 3) H5 works by extending HTML functionality through new tags and APIs. 4) Basic usage includes creating graphics using it, and advanced usage involves WebStorageAPI. 5) Developers need to pay attention to browser compatibility and performance optimization.

H5: New Features and Capabilities for Web DevelopmentH5: New Features and Capabilities for Web DevelopmentApr 29, 2025 am 12:07 AM

H5 brings a number of new functions and capabilities, greatly improving the interactivity and development efficiency of web pages. 1. Semantic tags such as enhance SEO. 2. Multimedia support simplifies audio and video playback through and tags. 3. Canvas drawing provides dynamic graphics drawing tools. 4. Local storage simplifies data storage through localStorage and sessionStorage. 5. The geolocation API facilitates the development of location-based services.

H5: Key Improvements in HTML5H5: Key Improvements in HTML5Apr 28, 2025 am 12:26 AM

HTML5 brings five key improvements: 1. Semantic tags improve code clarity and SEO effects; 2. Multimedia support simplifies video and audio embedding; 3. Form enhancement simplifies verification; 4. Offline and local storage improves user experience; 5. Canvas and graphics functions enhance the visualization of web pages.

HTML5: The Standard and its Impact on Web DevelopmentHTML5: The Standard and its Impact on Web DevelopmentApr 27, 2025 am 12:12 AM

The core features of HTML5 include semantic tags, multimedia support, offline storage and local storage, and form enhancement. 1. Semantic tags such as, etc. to improve code readability and SEO effect. 2. Simplify multimedia embedding with labels. 3. Offline storage and local storage such as ApplicationCache and LocalStorage support network-free operation and data storage. 4. Form enhancement introduces new input types and verification properties to simplify processing and verification.

H5 Code Examples: Practical Applications and TutorialsH5 Code Examples: Practical Applications and TutorialsApr 25, 2025 am 12:10 AM

H5 provides a variety of new features and functions, greatly enhancing the capabilities of front-end development. 1. Multimedia support: embed media through and elements, no plug-ins are required. 2. Canvas: Use elements to dynamically render 2D graphics and animations. 3. Local storage: implement persistent data storage through localStorage and sessionStorage to improve user experience.

The Connection Between H5 and HTML5: Similarities and DifferencesThe Connection Between H5 and HTML5: Similarities and DifferencesApr 24, 2025 am 12:01 AM

H5 and HTML5 are different concepts: HTML5 is a version of HTML, containing new elements and APIs; H5 is a mobile application development framework based on HTML5. HTML5 parses and renders code through the browser, while H5 applications need to run containers and interact with native code through JavaScript.

The Building Blocks of H5 Code: Key Elements and Their PurposeThe Building Blocks of H5 Code: Key Elements and Their PurposeApr 23, 2025 am 12:09 AM

Key elements of HTML5 include,,,,,, etc., which are used to build modern web pages. 1. Define the head content, 2. Used to navigate the link, 3. Represent the content of independent articles, 4. Organize the page content, 5. Display the sidebar content, 6. Define the footer, these elements enhance the structure and functionality of the web page.

HTML5 and H5: Understanding the Common UsageHTML5 and H5: Understanding the Common UsageApr 22, 2025 am 12:01 AM

There is no difference between HTML5 and H5, which is the abbreviation of HTML5. 1.HTML5 is the fifth version of HTML, which enhances the multimedia and interactive functions of web pages. 2.H5 is often used to refer to HTML5-based mobile web pages or applications, and is suitable for various mobile devices.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment