css ghost buttons witch icon

How we can create ghost buttons using HTML and CSS? Solution: CSS Ghost Buttons With Icon reveal on Hover and also with Focus Effect.

Basically, “Ghost Button” is a simple button with border and transparent background color. Nowadays we use this on multiple places on the webpage, because of its looks minimal and pretty good. This post is for showing an example of customized ghost buttons.

Today you will learn to create Buttons with hover and focus effect. On a desktop, you can mouse over on the button to see hover effects, and focus on the buttons by pressing tab to see focus effect also. I am not sure on mobile, But I think if you press and hold on a button then you can see the hover effect.

So, Today I am sharing CSS Ghost Buttons With Icon. Basically, there are 4 simple buttons, but when you hover on it, then an icon and color appear over the buttons. In this design, there have 4 different kinds of buttons to show different logs like warning, error, success, etc. The available icons are matching with the massages, that creates it useful.

If you are thinking now how these buttons with icons actually are, then see the preview given below.

Preview Of Buttons Hover and Focus Effect

See this video preview to getting an idea of how buttons are looks like.

Live Demo

Now you can see this visually, Also you see live by pressing the live view button given above. If you like this, then get the source code of its.

You May Also Like:

CSS Ghost Buttons With Icon Source Code

Before sharing source code, let’s talk about it. First, I have created simple buttons using <button>  tag, after that I have placed a icon and span for text inside it. Now the whole tree looks like this: <button class="btn info"><i class="icon-class"></i><span>Text</span></button> .

I have placed four different icons in each buttons using Font-Awesome icons library. As you can see in the preview there are four buttons with different icons and texts. For icon reveal, first, I have placed icons with margin-left: -100%;  value and on hover its value becomes 0. On mouse hover we are doing two works first, remove the margin value of icon and fill background color.

After that, I have put a transition for creating the animation effects, the transition value is transition: all 300ms ease-in-out;  There is a focus effect you can see in the preview, you can see by pressing the tab button. For creating that, I have simply used .btn:focus { value } property.

All left things you will understand easily after getting the codes, I can’t explain all in writing. For creating these you have to create only 2 files. One for HTML and one for CSS. Follow the steps to creating this without any error.

index.html

Create an HTML file named ‘index.html‘ and put these codes given here below.

style.css

Now create a CSS file named ‘style.css‘ and put these codes given here.

That’s It. Now you have successfully created CSS Ghost Buttons With Icon on Hover and also with Focus Effect. If you have any doubt or question comment down below.

Thanks For Visiting, Keep Visiting.

10 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here