ElkArte Community

Project Support => Support => Topic started by: Burke Knight on February 06, 2024, 11:15:04 am

Title: Centering embedded video
Post by: Burke Knight on February 06, 2024, 11:15:04 am
Enable auto-embedding of video links.

I love this, but there's an issue I have found.
The inability to center the video.
I've tried all the css tricks I could think of, to no avail.
Not sure if YouTube has something coded in their end that limits the ability or not.
Title: Re: Centering embedded video
Post by: Spuds on February 06, 2024, 08:48:24 pm
There are s a lot of items going on in that.  We have the preview image, then the actual loading of the video (usually in an iframe) and the collapse box as well.

to center a video on the page, you could try adding

Code: [Select]
.elk_video_container {
display: grid;
justify-content: center;
}
to your index.css right above the .elk_video { section and see if that gives the desired effect.
Title: Re: Centering embedded video
Post by: Burke Knight on February 07, 2024, 10:18:55 am
I added it to custom.css and it works great.
I did my usual !important to be sure it would override.

Thank you, my friend.  :smiley:
Title: Re: Centering embedded video
Post by: Spuds on February 07, 2024, 04:24:49 pm
One thing to consider doing is make use the custom.css file.

Its a good place to add theme overrides and makes it easier to update a theme since it has not been directly edited.  custom.css is loaded last (if it exists) so it "over-writes' any previous selectors.   You can do the same with a custom.css file in the _variant directory to overwrite colors.
Title: Re: Centering embedded video
Post by: Burke Knight on February 07, 2024, 04:52:51 pm
Quote from: Spuds – custom.css is loaded last (if it exists) so it "over-writes' any previous selectors.

I still need to do the !important though.
Not sure if there's a way to make sure it overrides without having to do so, but it's something I felt needed to be said.

Quote from: Spuds – You can do the same with a custom.css file in the _variant directory to overwrite colors.

I didn't know about this one. Good to know.  :smiley: