# Form-centering is targeting the right border

**URL:** <https://community.hubspot.com/t/form-centering-is-targeting-the-right-border/10167>\
**Category:** CMS Development\
**Created:** [September 12, 2018, 11:43am UTC](https://community.hubspot.com/t/form-centering-is-targeting-the-right-border/10167 "2018-09-12T11:43:32Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![tette\_engage](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tette_engage/32/92090_2.png) [@tette\_engage](https://community.hubspot.com/u/tette_engage)\
**Post date:** [September 12, 2018, 11:43am UTC](https://community.hubspot.com/t/form-centering-is-targeting-the-right-border/10167/1 "2018-09-12T11:43:32Z")

</div>

Hi!

I tried to look for answers in previous posts, but everybody seemed to have slightly different issues regarding centering a form. I have tried using horizontal spacers, to no avail. When i use custom CSS, i get the form to center from its right border, like this:

 ![Screen Shot 2018-09-12 at 14.09.23.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/5/f/5f3119686d7eef16e93c7367ae3e1d7b92a4ca7d.png)

The most recent code I tried is this:

form.hs-form,  
.form-center .hs\_cos\_wrapper .form-title {  
max-width: 600px;  
display: block;  
margin: auto !important;  
text-align: center;  
}

I gave the form the css class of form-center, and I know the code does target the form because the text gets centered. I have tried having the form on its own, and inside a module (even tried classifying the module and targeting that one with the css). If I have mas-width: 50%, the box gets smaller and logically brings the form closer to the center. I can add padding to the left, but this becomes problematic with varying screen sizes.

Heres a link to a page with the form:

[http://www.prometheusone.io/-temporary-slug-3e2277e7-f080-417a-bad5-2110d5bf799f?hs\_preview=LUaZsPhC-6165934397](http://www.prometheusone.io/-temporary-slug-3e2277e7-f080-417a-bad5-2110d5bf799f?hs_preview=LUaZsPhC-6165934397)

---

<div class="post-metadata">

**Author:** ![tjoyce](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tjoyce/32/88832_2.png) [@tjoyce](https://community.hubspot.com/u/tjoyce)\
**Post date:** [September 12, 2018, 11:48am UTC](https://community.hubspot.com/t/form-centering-is-targeting-the-right-border/10167/2 "2018-09-12T11:48:22Z")

</div>

Hello [@tette\_engage](https://community.hubspot.com/t5/user/viewprofilepage/user-id/70145) -

Try:

```auto
#hs_form_target_module_1536670727023670 {
 margin: auto;
}

```

* * *

If this answer helped, please, mark as solved 😄

* * *

[tim@belch.io](mailto:tim@belch.io) | [forms.belch.io](https://forms.belch.io) | Design your own Beautiful HubSpot Forms; No coding necessary.

Drop by and say Hi to me [on slack](http://slack.belch.io/).

---

<div class="post-metadata">

**Author:** ![tette\_engage](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tette_engage/32/92090_2.png) [@tette\_engage](https://community.hubspot.com/u/tette_engage)\
**Post date:** [September 12, 2018, 11:51am UTC](https://community.hubspot.com/t/form-centering-is-targeting-the-right-border/10167/3 "2018-09-12T11:51:31Z")

</div>

Almost there! Now the form is centered, but the submit-button is slightly on the right

---

<div class="post-metadata">

**Author:** ![tjoyce](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tjoyce/32/88832_2.png) [@tjoyce](https://community.hubspot.com/u/tjoyce)\
**Post date:** [September 12, 2018, 11:53am UTC](https://community.hubspot.com/t/form-centering-is-targeting-the-right-border/10167/4 "2018-09-12T11:53:50Z")

</div>

[@tette\_engage](https://community.hubspot.com/t5/user/viewprofilepage/user-id/70145) - It’s technically centered, it’s just that the button width is wider than your form width, giving the appearance of off center.

You should add this css to widen your form a bit:

```auto
#hs_form_target_module_1536670727023670 form.hs-form, .form-center .hs_cos_wrapper .form-title {
 max-width: 600px;
}

```

---

<div class="post-metadata">

**Author:** ![tette\_engage](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tette_engage/32/92090_2.png) [@tette\_engage](https://community.hubspot.com/u/tette_engage)\
**Post date:** [September 12, 2018, 12:01pm UTC](https://community.hubspot.com/t/form-centering-is-targeting-the-right-border/10167/5 "2018-09-12T12:01:20Z")

</div>

Ah! I see. That fixed it, perfect! Thanks  
 ![16x16_smiley-happy.png.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/2/22d5e40d253def47f5f4ea7f0e3e70be19010689.png)

---

<div class="post-metadata">

**Author:** ![tjoyce](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tjoyce/32/88832_2.png) [@tjoyce](https://community.hubspot.com/u/tjoyce)\
**Post date:** [September 12, 2018, 12:03pm UTC](https://community.hubspot.com/t/form-centering-is-targeting-the-right-border/10167/6 "2018-09-12T12:03:11Z")

</div>

Awesome, just checked it out, looks good.

---

<div class="post-metadata">

**Author:** ![Accelerated](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/accelerated/32/30191_2.png) [@Accelerated](https://community.hubspot.com/u/Accelerated)\
**Post date:** [April 30, 2020, 7:33pm UTC](https://community.hubspot.com/t/form-centering-is-targeting-the-right-border/10167/7 "2020-04-30T19:33:41Z")

</div>

Hello,

How can I center a form created on hubspot, yet when posted on my external website, the form aligns to the left. I’ve read a few of the help posts and responses about CSS and spacers. I don’t believe I have access to CSS and can’t locate where the spacers are. Can someone helps.

Here’s how the form looks: [https://acceleratedcourtreporting.com/pages/schedule-a-deposition](https://acceleratedcourtreporting.com/pages/schedule-a-deposition)

---

<div class="post-metadata">

**Author:** ![tjoyce](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tjoyce/32/88832_2.png) [@tjoyce](https://community.hubspot.com/u/tjoyce)\
**Post date:** [April 30, 2020, 8:38pm UTC](https://community.hubspot.com/t/form-centering-is-targeting-the-right-border/10167/8 "2020-04-30T20:38:14Z")

</div>

@Accelerated - you can add the following CSS to your page to fix this

```auto
<style>
#hs-form-iframe-0 {width: 500px!important;margin:auto!important;}
</style>

```
