Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Pure CSS Floating Action Button
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Markshall" data-source="post: 441082" data-attributes="member: 1872"><p>I think it's safe to say that by now, we've all seen the 'floating action button' effect. Correct me if I'm wrong, but it was popularised by Google with the Material design language.</p><p>Well, if you've not seen it, it's a button that floats (usually at the bottom right of a document), and when clicked, it displays a list of actions.</p><p></p><p>As ever, I'm using one of my favourite tricks of styling a checkbox as a toggle-listener rather than using JavaScript.</p><p></p><p><img src="https://i.sharefa.st/mYVpoLuA3nE3.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /><img src="https://i.sharefa.st/oD8h7T0H3nE3.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p><a href="https://codepen.io/Markshall/pen/wQyWqq" target="_blank">https://codepen.io/Markshall/pen/wQyWqq</a></p><p></p><p>CSS:</p><p>[CODE=css]body {</p><p> background-color: #f5f5f5;</p><p>}</p><p></p><p>.adminActions {</p><p> position: fixed;</p><p> bottom: 35px; right: 35px;</p><p>}</p><p></p><p> .adminButton {</p><p> height: 60px;</p><p> width: 60px;</p><p> background-color: rgba(67, 83, 143, .8);</p><p> border-radius: 50%;</p><p> display: block;</p><p> color: #fff;</p><p> text-align: center;</p><p> position: relative;</p><p> z-index: 1;</p><p> }</p><p></p><p> .adminButton i {</p><p> font-size: 22px;</p><p> }</p><p></p><p> .adminButtons {</p><p> position: absolute;</p><p> width: 100%;</p><p> bottom: 120%;</p><p> text-align: center;</p><p> }</p><p></p><p> .adminButtons a {</p><p> display: block;</p><p> width: 45px;</p><p> height: 45px;</p><p> border-radius: 50%;</p><p> text-decoration: none;</p><p> margin: 10px auto 0;</p><p> line-height: 1.15;</p><p> color: #fff;</p><p> opacity: 0;</p><p> visibility: hidden;</p><p> position: relative;</p><p> box-shadow: 0 0 5px 1px rgba(51, 51, 51, .3);</p><p> }</p><p></p><p> .adminButtons a:hover {</p><p> transform: scale(1.05);</p><p> }</p><p></p><p> .adminButtons a:nth-child(1) {background-color: #ff5722; transition: opacity .2s ease-in-out .3s, transform .15s ease-in-out;}</p><p> .adminButtons a:nth-child(2) {background-color: #03a9f4; transition: opacity .2s ease-in-out .25s, transform .15s ease-in-out;}</p><p> .adminButtons a:nth-child(3) {background-color: #f44336; transition: opacity .2s ease-in-out .2s, transform .15s ease-in-out;}</p><p> .adminButtons a:nth-child(4) {background-color: #4CAF50; transition: opacity .2s ease-in-out .15s, transform .15s ease-in-out;}</p><p></p><p> .adminActions a i {</p><p> position: absolute;</p><p> top: 50%; left: 50%;</p><p> transform: translate(-50%, -50%);</p><p> }</p><p></p><p> .adminToggle {</p><p> -webkit-appearance: none;</p><p> position: absolute;</p><p> border-radius: 50%;</p><p> top: 0; left: 0;</p><p> margin: 0;</p><p> width: 100%;</p><p> height: 100%;</p><p> cursor: pointer;</p><p> background-color: transparent;</p><p> border: none;</p><p> outline: none;</p><p> z-index: 2;</p><p> transition: box-shadow .2s ease-in-out;</p><p> box-shadow: 0 3px 5px 1px rgba(51, 51, 51, .3);</p><p> }</p><p></p><p> .adminToggle:hover {</p><p> box-shadow: 0 3px 6px 2px rgba(51, 51, 51, .3);</p><p> }</p><p></p><p> .adminToggle:checked ~ .adminButtons a {</p><p> opacity: 1;</p><p> visibility: visible;</p><p> }[/CODE]</p><p></p><p>HTML:</p><p>[CODE=html]<div class="adminActions"></p><p> <input type="checkbox" name="adminToggle" class="adminToggle" /></p><p> <a class="adminButton" href="#!"><i class="fa fa-cog"></i></a></p><p> <div class="adminButtons"></p><p> <a href="#" title="Add Company"><i class="fa fa-building"></i></a></p><p> <a href="#" title="Edit Company"><i class="fa fa-pen"></i></a></p><p> <a href="#" title="Add User"><i class="fa fa-user-plus"></i></a></p><p> <a href="#" title="Edit User"><i class="fa fa-user-edit"></i></a></p><p> </div></p><p></div>[/CODE]</p></blockquote><p></p>
[QUOTE="Markshall, post: 441082, member: 1872"] I think it's safe to say that by now, we've all seen the 'floating action button' effect. Correct me if I'm wrong, but it was popularised by Google with the Material design language. Well, if you've not seen it, it's a button that floats (usually at the bottom right of a document), and when clicked, it displays a list of actions. As ever, I'm using one of my favourite tricks of styling a checkbox as a toggle-listener rather than using JavaScript. [IMG]https://i.sharefa.st/mYVpoLuA3nE3.png[/IMG][IMG]https://i.sharefa.st/oD8h7T0H3nE3.png[/IMG] [URL]https://codepen.io/Markshall/pen/wQyWqq[/URL] CSS: [CODE=css]body { background-color: #f5f5f5; } .adminActions { position: fixed; bottom: 35px; right: 35px; } .adminButton { height: 60px; width: 60px; background-color: rgba(67, 83, 143, .8); border-radius: 50%; display: block; color: #fff; text-align: center; position: relative; z-index: 1; } .adminButton i { font-size: 22px; } .adminButtons { position: absolute; width: 100%; bottom: 120%; text-align: center; } .adminButtons a { display: block; width: 45px; height: 45px; border-radius: 50%; text-decoration: none; margin: 10px auto 0; line-height: 1.15; color: #fff; opacity: 0; visibility: hidden; position: relative; box-shadow: 0 0 5px 1px rgba(51, 51, 51, .3); } .adminButtons a:hover { transform: scale(1.05); } .adminButtons a:nth-child(1) {background-color: #ff5722; transition: opacity .2s ease-in-out .3s, transform .15s ease-in-out;} .adminButtons a:nth-child(2) {background-color: #03a9f4; transition: opacity .2s ease-in-out .25s, transform .15s ease-in-out;} .adminButtons a:nth-child(3) {background-color: #f44336; transition: opacity .2s ease-in-out .2s, transform .15s ease-in-out;} .adminButtons a:nth-child(4) {background-color: #4CAF50; transition: opacity .2s ease-in-out .15s, transform .15s ease-in-out;} .adminActions a i { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } .adminToggle { -webkit-appearance: none; position: absolute; border-radius: 50%; top: 0; left: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; background-color: transparent; border: none; outline: none; z-index: 2; transition: box-shadow .2s ease-in-out; box-shadow: 0 3px 5px 1px rgba(51, 51, 51, .3); } .adminToggle:hover { box-shadow: 0 3px 6px 2px rgba(51, 51, 51, .3); } .adminToggle:checked ~ .adminButtons a { opacity: 1; visibility: visible; }[/CODE] HTML: [CODE=html]<div class="adminActions"> <input type="checkbox" name="adminToggle" class="adminToggle" /> <a class="adminButton" href="#!"><i class="fa fa-cog"></i></a> <div class="adminButtons"> <a href="#" title="Add Company"><i class="fa fa-building"></i></a> <a href="#" title="Edit Company"><i class="fa fa-pen"></i></a> <a href="#" title="Add User"><i class="fa fa-user-plus"></i></a> <a href="#" title="Edit User"><i class="fa fa-user-edit"></i></a> </div> </div>[/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Pure CSS Floating Action Button
Top