Smitha
Smitha

Reputation: 6134

How to add a custom button to a page using bootstrap 3?

i have following code using which I am trying to add a facebook icon button to my page. But, I am unable to see that image bg in my page.

<button class="facebook"></button>  

My css :

.facebook{  
    background: url('../img/fb.jpg') no-repeat   
}  

I have included the css file in my html pg too:

 <link href="../css/custom.css" rel="stylesheet" media="screen">  

How do I fix this?

Thanks

Upvotes: 0

Views: 911

Answers (4)

Nimit Vachhani
Nimit Vachhani

Reputation: 65

You can assign your custom class to your button input.

 <input type="submit" value="Submit" class="facebook">

o so you are using fontawesome... correct ..

 <linkbutton class="myclass"><i class="fa fa-facebook"></i> fa-facebook</linkbutton >

This is what i do in my asp.net

Upvotes: 0

Bazinga777
Bazinga777

Reputation: 5281

Since you are using bootstrap, you can use fontawesome icons for your buttons using the cdn or downloading the glyphicons

           <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.1/css/font-awesome.css" rel="stylesheet">
              <button class="facebook" ><i class="fa fa-facebook fa-2x"></i>facebook</button> 

         In you code you could have missed the correct link to your css file. Check the absolute or relative links to the css file. 

         <link href="../css/custom.css" rel="stylesheet" media="screen"> 

You also missed the semi colon in

              background: url('../img/fb.jpg') no-repeat  

Upvotes: 0

Vladislav Stanic
Vladislav Stanic

Reputation: 795

When using bootstrap 3 you have something like this:

<button type="button" class="btn">My button</button>

If you want to add some background to that button, add your class:

<button type="button" class="btn facebook">My button</button>

Be sure that you first add bootstrap css to your page and then your custom css because the last css overrides previous ones.

Upvotes: 1

jitender
jitender

Reputation: 33

may be you are missing ';' in css code

Upvotes: 0

Related Questions