February 24, 20179 yr Hi Folks, I am trying to centre a number of videos in a page that i am currently working on, and am having some issues. The link reads - <iframe width="560" height="315" align="centre" src="https://www.youtube.com/embed/1gxyHSDW96s" frameborder="0" allowfullscreen></iframe> Is there anything I am doing wrong? Cheers, Dan
February 26, 20179 yr The align attribute is deprecated. Use CSS to align and position your elements. BTW even if browsers would still interpret the align attribute your value "centre" is invalid. The attribute can have the following values: left, right, middle, top or bottom Edited February 26, 20179 yr by Nillervision
March 1, 20179 yr iframe { display: block; margin: auto; width: 560px; height: 315px; } That should do it.
May 3, 20179 yr You can try this one also. HTML: <div id="all"> <div class="sub">div</div> <iframe>Video embedding code</iframe> </div> CSS: #all { width:100%; float:left; text-align:center; } div.sub, iframe { width:100px; height:50px; margin:0 auto; background-color:#777;} It works perfectly for me. Hope it will be helpful to you also.
May 3, 20179 yr You can try this one also. [snipped copy-paste code] It works perfectly for me. Hope it will be helpful to you also. Should you want a couple of extra divs, some irrelevant floating, a video only 50px high .... ... it will be perfect.
Create an account or sign in to comment