Css background video

0 votes

Could someone please center the background of this video?

I tried:

margin: 0 auto;
text-align: center;

So far but none of these worked.

This is my code.

Html:

<video autoplay loop poster="polina.jpg" id="vid">
<source src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.webm" type="video/webm">
<source src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" type="video/mp4">
</video>

CSS:

video#vid {
 position: fixed; right: 0; bottom: 0;
 min-width: 100%; min-height: 100%;
 width: auto; height: auto; z-index: -100;
 background: url(polina.jpg) no-repeat;
 background-size: cover;
 margin: 0 auto;
}

How can I center this video backdrop so that when the window is resized, the left and right sides are removed by the same amount? I appreciate your assistance.

Aug 19, 2022 in CSS by Edureka
• 13,620 points
299 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In CSS

0 votes
1 answer

How do I give text or an image a transparent background using CSS?

Use either a semi-transparent PNG or SVG ...READ MORE

answered May 27, 2022 in CSS by Edureka
• 12,690 points
395 views
0 votes
1 answer

CSS shadow white line at the end of linear-gradient background

This is a byproduct of the gradient ...READ MORE

answered Jun 1, 2022 in CSS by Edureka
• 12,690 points
2,362 views
0 votes
1 answer

Position a CSS background image x pixels from the right?

The attribute border can be used as ...READ MORE

answered Jun 10, 2022 in CSS by Edureka
• 12,690 points
703 views
0 votes
1 answer

When to use IMG vs. CSS background-image?

You can transition a div's background image ...READ MORE

answered Jun 10, 2022 in CSS by Edureka
• 12,690 points
687 views
0 votes
1 answer

CSS Background Opacity

The CSS opacity property can be used ...READ MORE

answered Jun 17, 2022 in CSS by Edureka
• 12,690 points
570 views
0 votes
1 answer

How to use CSS media query to scale background-image to viewing window

If you only want the desktop version ...READ MORE

answered Jun 17, 2022 in CSS by Edureka
• 12,690 points
1,071 views
0 votes
0 answers

CSS background image that can scroll

I'm attempting to make a backdrop image ...READ MORE

Jul 5, 2022 in CSS by Edureka
• 13,620 points
1,331 views
0 votes
0 answers

Stretch background image css?

<td class="style1" align='left' height='35'> <div style='overflow: ...READ MORE

Jul 11, 2022 in CSS by Edureka
• 13,620 points
433 views
0 votes
0 answers

CSS background image URL path

Hello, I'm attempting to utilise CSS to ...READ MORE

Aug 10, 2022 in CSS by Edureka
• 13,620 points
919 views
0 votes
0 answers

Javascript remove background color and opacity

How can I delete the background-color  ...READ MORE

Dec 6, 2022 in Java by Nicholas
• 7,760 points
1,942 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP