Forum Moderators: not2easy

Message Too Old, No Replies

Centering video player

         

wahidpolin

12:57 pm on Jan 14, 2011 (gmt 0)

10+ Year Member



I am using JW Player as a video player in one of my sales page but having trouble to get it centered in the page.

I have set the margin to auto but it's not working.

heres the html ->

<div id="videocontainer">
<object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="328" height="200">
<param name="movie" value="player.swf" />
<param name="allowfullscreen" value="true" />
<param name="allowscriptaccess" value="always" />
<param name="flashvars" value="file=video.mp4&image=preview.jpg" />
<embed
type="application/x-shockwave-flash"
id="player2"
name="player2"
src="player.swf"
width="328"
height="200"
allowscriptaccess="always"
allowfullscreen="true"
flashvars="file=video.mp4&image=preview.jpg"
/>
</object>
</div>

wa9578

1:19 pm on Jan 14, 2011 (gmt 0)

10+ Year Member



I'm not the best at coding but I have something like this on my site. I think this should fix it;



<div id="videocontainer">
<center>
<object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="328" height="200">
<param name="movie" value="player.swf" />
<param name="allowfullscreen" value="true" />
<param name="allowscriptaccess" value="always" />
<param name="flashvars" value="file=video.mp4&image=preview.jpg" />
<embed
type="application/x-shockwave-flash"
id="player2"
name="player2"
src="player.swf"
width="328"
height="200"
allowscriptaccess="always"
allowfullscreen="true"
flashvars="file=video.mp4&image=preview.jpg"
/>
</object> </center>
</div>

wahidpolin

1:44 pm on Jan 14, 2011 (gmt 0)

10+ Year Member



hey bro thanks for the help.It worked like a charm :D

rocknbil

5:45 pm on Jan 14, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Visually, yes, but <center> has been deprecated for years, along with <font>. Being this is the CSS forum, how about a more correct approach:

<style type="text/css">
#videocontainer { width:328px;height:200px; margin: auto; }
</style>


You may have to fiddle with w/h depending on what the player adds for borders, etc., but that is a better approach.

wa9578

10:34 am on Jan 15, 2011 (gmt 0)

10+ Year Member



Cheers rocknbil, I'm a noob too so I didn't know that approach will amend my site to use that method too