Website Building » Squarespace » How Do I Center Embed Code Squarespace?

How Do I Center Embed Code Squarespace?

Last updated on December 13, 2022 @ 9:28 am

There are many ways to center embed code in Squarespace. One way is to use the <center> tag. This will center everything within the code, including text and images.

Another way is to use CSS (cascading style sheets). This is a more advanced method, but it gives you more control over how your code is displayed. You can also use HTML tags to center your code.

The <center> tag is the easiest way to center embed code in Squarespace. Simply add the tag before your code and everything within the code will be centered.

<center>
<iframe width="560" height="315" src="https://www.youtube.com/embed/L9YvN_Wd7bU" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</center>

CSS is a more advanced method, but it gives you more control over how your code is displayed. To center embed code using CSS, you need to add the following code to the <head> section of your website:

<style>
.centered {
text-align: center;
}
</style>

Then, add the “centered” class to the code you want to center. For example:

<div class="centered">
<iframe width="560" height="315" src="https://www.com/embed/L9YvN_Wd7bU" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>

HTML tags can also be used to center embed code in Squarespace. The

tag can be used to center text within your code, and the <img> tag can be used to center images. For example:

<p style="text-align:center;">Text goes here </p>

PRO TIP: If you are not careful, centering your embed code on Squarespace can result in unpredictable results. Make sure to test your code in various browsers before you publish it to your live site.
Morgan Bash

Morgan Bash

Technology enthusiast and Co-Founder of Women Coders SF.