# Center Videos in OneBox

**URL:** <https://meta.discourse.org/t/center-videos-in-onebox/61879>\
**Category:** Support\
**Created:** [2017年四月30日 23:58 UTC](https://meta.discourse.org/t/center-videos-in-onebox/61879 "2017-04-30T23:58:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Iceman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/iceman/32/181309_2.png) [@Iceman](https://meta.discourse.org/u/Iceman)\
**Post date:** [2017年四月30日 23:58 UTC](https://meta.discourse.org/t/center-videos-in-onebox/61879/1 "2017-04-30T23:58:33Z")

</div>

Hi All,

Discourse is really great (first of all) and my team is really loving it.

However, a doubt arised and I tried anything and don’t seem to be able to do it: How do I center a YT video with OneBox? (Or any video) Since the URL can’t be touched with BBCode…

Or maybe is there a way to set the width for the videos so they always appear with the max width?

Sorry for such a n00b question.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Steven](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steven/32/187890_2.png) [@Steven](https://meta.discourse.org/u/Steven)\
**Post date:** [2017年五月1日 00:09 UTC](https://meta.discourse.org/t/center-videos-in-onebox/61879/2 "2017-05-01T00:09:56Z")

</div>

Someone posted this css code a while ago and it still works for me (add it on Admin\>Customize\>Theme, edit a CSS in Common) :

```
.lazyYT {
    height: 0 !important;
    width: 100% !important;
    padding-bottom: 56.25% !important;
}

```

But it only works for the youtube videos

---

<div class="post-metadata">

**Author:** ![Slowhand](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/slowhand/32/57436_2.png) [@Slowhand](https://meta.discourse.org/u/Slowhand)\
**Post date:** [2017年五月1日 21:30 UTC](https://meta.discourse.org/t/center-videos-in-onebox/61879/3 "2017-05-01T21:30:07Z")

</div>

You can center anything (YT Videos, pictures and text) by using the following:

```
<div align=center>
picture/text/video
</div>

```

Looks like this:

This is centered.

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)\
**Post date:** [2019年五月31日 12:01 UTC](https://meta.discourse.org/t/center-videos-in-onebox/61879/4 "2019-05-31T12:01:52Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)\
**Post date:** [2019年六月30日 12:01 UTC](https://meta.discourse.org/t/center-videos-in-onebox/61879/5 "2019-06-30T12:01:59Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
