How do you center a video using CSS
I’m trying to center a video within my site but I don’t want to use the center tags in HTML because it’s kinda obsolete. How do I do this with CSS? Here’s my HTML code if it’s any help.
I’m trying to center a video within my site but I don’t want to use the center tags in HTML because it’s kinda obsolete. How do I do this with CSS? Here’s my HTML code if it’s any help.
Expand snippet
there are some mistakes in your code – the first: you havn’t closed you p-tag: next: p stands for ‘paragraph’ and is a block-element (so it’s causing a line-break). what you wanted to use there is a span, wich is just an inline-element for formatting: but if you just want to add a style to your link, why don’t … Read more
Koen’s answer doesn’t exactly centers the element. The proper way is to use CCS3 transform property. Although it’s not supported in some old browsers. And we don’t even need to set a fixed or relative width. Working jsfiddle comparison here.
Just set width to 100%
How can I center an inline div (not its content) using css? VERY IMPORTANT: the width of the div is unknown (I can not specify it)
After trying a lot of things I find a way that works. I share it here if it is useful to anyone. You can see it here working: http://jsbin.com/iquviq/30/edit
Set also android:gravity parameter in TextView to center. For testing the effects of different layout parameters I recommend to use different background color for every element, so you can see how your layout changes with parameters like gravity, layout_gravity or others.
http://jsfiddle.net/SebastianPataneMasuelli/rJxQC/ i just wrapped a div around them and made it align center. then you don’t need any css on the buttons to center them.
Run code snippet