So... this is starting to annoy me ... and I thought i would come here and get some help..
The main div around the box has a width... then there is text... and a button that i want in the center of the div..
it is a <a href>
button.. but it wont center.
I didn't think I would need to specify a width since the outside div has a width.. i tried margin:0 auto; text-align:center
etc nothing works
<h2 class="service-style color_service">Annoyed</h2>
<div class="service-text text1">
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua Lorem ipsum dolor sit amet…
</p>
<a href="" class="button button-large"><i class="fa fa-credit-card" style="padding-right:10px;"></i> Learn More</a>
</div>
here is the fiddle link
You have the problem because of the
display:inline-block
...see hereIn this section of css,add:
Remove all the
margin
's set atbutton
class and amend as below:EDIT : to use inline-block without setting a width
inline-block demo
How to do only solution to center inline-block element is to use
text-align:center
in your css class:
and then add:
this way you wont need to give
width
and onlypadding
would solve your problem!Try to include your button in a div and update
CSS
as given belowQuick way is to add
"text-align: center;"
to.service-text
.