Title: Centering Custom HTML Script
Last modified: March 13, 2024

---

# Centering Custom HTML Script

 *  Resolved [nish4x](https://wordpress.org/support/users/nish4x/)
 * (@nish4x)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/centering-custom-html-script/)
 * I am having some issues trying to center a custom html block with a generated
   script. This script allows users to search my inventory for available properties.
   It is left aligned within my section and I cannot figure out how to center this.
 *     ```wp-block-code
       <div id="search-widget_IO312PWQ"><center><script>!function(e,t,a,n,c,r){function s(t){e.console.log("[Guesty Embedded Widget]:",t)}var i,d,l,o,y,m,g,h,p,u;n&&(i=n,d=t.getElementsByTagName("head")[0],(l=t.createElement("link")).rel="stylesheet",l.type="text/css",l.href=i,l.media="all",d.appendChild(l)),o=function(){try{e[a].create(r).catch(function(e){s(e.message)})}catch(e){s(e.message)}},h=!1,y=c,m=function(){h||this.readyState&&"complete"!=this.readyState||(h=!0,o())},(g=t.createElement("script")).type="text/javascript",g.src=y,g.async="true",g.onload=g.onreadystatechange=m,p=g,(u=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,u)}(window,document,"GuestySearchBarWidget","https://s3.amazonaws.com/guesty-frontend-production/search-bar-production.css","https://s3.amazonaws.com/guesty-frontend-production/search-bar-production.js",{"siteUrl":"titanbr.guestybookings.com"});</script></center></div>
       ```
   
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcentering-custom-html-script%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/centering-custom-html-script/#post-17498623)
 * You should refrain from using `<center>` . Apart from the fact that this is wrong
   at this point, it also does not correspond to the current state of web development.
 * The following CSS code is sufficient to achieve your goal:
 *     ```wp-block-code
       .guesty-root-element.guesty-widget__container {
        align-items: center;
        justify-content: center;
       }
       ```
   
 * You can store this under Appearance > Customiser > Additional CSS.
 *  Thread Starter [nish4x](https://wordpress.org/support/users/nish4x/)
 * (@nish4x)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/centering-custom-html-script/#post-17498670)
 * threadi, thank you!
    -  This reply was modified 2 years, 2 months ago by [nish4x](https://wordpress.org/support/users/nish4x/).

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Centering Custom HTML Script’ is closed to new replies.

 * In: [Everything else WordPress](https://wordpress.org/support/forum/miscellaneous/)
 * 2 replies
 * 2 participants
 * Last reply from: [nish4x](https://wordpress.org/support/users/nish4x/)
 * Last activity: [2 years, 2 months ago](https://wordpress.org/support/topic/centering-custom-html-script/#post-17498670)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
