Quantcast
Channel: How can I style a Stripe Elements input with Bootstrap? - Stack Overflow
Viewing all articles
Browse latest Browse all 7

Answer by michael for How can I style a Stripe Elements input with Bootstrap?

$
0
0

After digging around the docs a bit more, I found that https://stripe.com/docs/stripe.js#the-element-container says "Youshould style the container you mount an Element to as if it were an on your page."

By adding Bootstrap's form-control class to the <div> I'm mounting the Element in, the field looks almost like any other Bootstrap-styled input field:

<div id="card-element" class="form-control"></div>

For some reason, the height of the field doesn't quite match, but through trial and error, I got itwith:

var stripe = Stripe('your_key');var elements = stripe.elements();var card = elements.create('card', { style:  {    base: {      lineHeight: '1.429'    }  }});card.mount('#card-element');

Viewing all articles
Browse latest Browse all 7

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>