tags:

views:

300

answers:

4

Hi, could anyone please help me with a problem I have been having with a 100% - 350px layout for embedding vimeo video?

It seems like the right-margin property is getting ignored here, and the layout is overflowing to the right. I'm hoping this a simple mistake, but seems like I've tried everything. I'm running out of time.

Help would be really appreciated.

css:

#container {
 position:absolute;
 width:100%;
    height:100%;
}

#content {
 width:100%;
 height:100%;
 margin-left:350px;
 margin-right:350px;
}

.video {
 padding:0 0 0 0;
 height:100%;
 width:100%;
}

html (the vimeo embed code has been reformatted for validation):

<div id="container">
   <div id="content">
      <object class="video" type="application/x-shockwave-flash" data="http://vimeo.com/moogaloop.swf?clip_id=8808526&amp;amp;server=vimeo.com&amp;amp;show_title=0&amp;amp;show_byline=0&amp;amp;show_portrait=0&amp;amp;color=ffffff"&gt;
     <param name="allowfullscreen" value="true" />
     <param name="allowscriptaccess" value="always" />
        <param name="color" value="ffffff" />
     <param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=8808526" />
      </object>
     <div style="clear:both; height:1px; line-height:0">&nbsp;</div>
  </div>
</div>

EDIT: Another solution I have tried:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
#container {
    position:absolute;
    width:100%;
    height:100%;
}

#content {
    margin-left: 350px;
    margin-right: 0px;
}

.video {
    padding:0 0 0 0;
    width:100%;
    height:100%;
}
</style>
</head>

<body>

<div id="container">
   <div id="content">
      <object class="video" type="application/x-shockwave-flash" data="http://vimeo.com/moogaloop.swf?clip_id=8808526&amp;amp;server=vimeo.com&amp;amp;show_title=0&amp;amp;show_byline=0&amp;amp;show_portrait=0&amp;amp;color=ffffff"&gt;
     <param name="allowfullscreen" value="true" />
     <param name="allowscriptaccess" value="always" />
        <param name="color" value="ffffff" />
     <param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=8808526" />
      </object>
  </div>
</div>

</body>
</html>
</head>

Edit: I'm using the solution for this type of positioning from this thread: http://stackoverflow.com/questions/899107/how-can-i-do-width-100-100px-in-css

A: 

The width of an element does not necessarily prevent elements contained within it from overflowing that element.

If you wish things outside your DIV not to display, set its overflow to hidden: overflow: hidden.

I'm not even sure if I'm understanding your issue properly, to be honest. A clarification of what you're actually hoping to achieve might be helpful if I'm complete misreading you.

EDIT BELOW

Your approach is a bit strange, try this:

<div id="container">
    <object> ... </object>
</div>


<style>
  #container { position: absolute; right: 5px; }
</style>

Additionally, you're trying to size the video with CSS -- CSS isn't going to have any effect on an object. If you were to change, say, to video { width: 50px; } it would not make your video 50px wide.

Erik
Emile
I'm confused by your edit. The Object CSS style is indeed effecting the width of the video. I would like to make the video object a 100% width and height - 350px layout and the reason why I'm doing it this way is because of the solutions that can be found on this thread:http://stackoverflow.com/questions/899107/how-can-i-do-width-100-100px-in-css
Emile
Thankyou very much for your time Erik, I really appreciate it. I have posted the solution as a 'new solution'.
Emile
Actually, CSS **does** have an effect on the object. At least when he's not using the DOCTYPE. How do you explain this? And what is the 'correct' way of sizing a video object?
littlegreen
Look at the embed code from any youtube video; object tags have height and width attributes -- like img tags do.
Erik
Looked it up after posting, you're right.
littlegreen
A: 

In order to make the video smaller to stop at the right hand side of the screen (fit to the screen), you'll have to drop some of the 100% attributes and make a few more edits. Here's the new CSS and HTML.

CSS

#container {
    width:100%;
    height:100%;
}

#content {
    margin-left: 350px;
    margin-right: 0px;
}

.video {
    padding:0 0 0 0;
    width:100%;
    height:90%;
}

HTML

<div id="container">
   <div id="content">
      <object class="video" type="application/x-shockwave-flash" data="http://vimeo.com/moogaloop.swf?clip_id=8808526&amp;amp;server=vimeo.com&amp;amp;show_title=0&amp;amp;show_byline=0&amp;amp;show_portrait=0&amp;amp;color=ffffff"&gt;
     <param name="allowfullscreen" value="true" />
     <param name="allowscriptaccess" value="always" />
        <param name="color" value="ffffff" />
     <param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=8808526" />
      </object>
  </div>
</div>

EDIT As Emile rightly pointed out, for some reason this only works if you don't set a DOCTYPE for your document. Otherwise it works in Chrome, but Firefox shows a blank screen. After some testing I concluded that this has to do with the percentage widths given for the video object. Firefox doesn't support that.

As Vimeo (unlike YouTube) doesn't allow URL parameters to be passed for determining the video size, and percentage widths apparently have quirks, my only other suggestion would be to specify a fixed width and height on the video object (like on this page, see the page source), set the visibility of the content DIV to invisible, use a Javascript or jQuery function to determine the page width, change the width/height attributes of the OBJECT tag accordingly, and set the object to visible again. It's not very neat, but it'll probably work, and it would be independent of doctype.

EDIT I have implemented this solution, and it works in all browsers. See my separate new answer about it.

littlegreen
Emile
Oh, And I'd like to get the video to stop at the right hand side of the screen.
Emile
OK, I've narrowed down my answer to reflect your clarification. By the way, I tested my code, and it's working in Chrome, Firefox and IE. Did you copypaste my code literally?
littlegreen
Correction, IE doesnt display the video, but the videoframe is the right size though. See also here: http://www.antiflu.dds.nl/so3/
littlegreen
I did copy paste the code literally, it's strange. There must be something else on the page messing with this. Thanks for this clarification, I'll have to do some code sifting.
Emile
This is indeed puzzling, I have trimmed the page right down to the bare bones and the problem still exists. I'll post my code in a following comment. Hopefully you'll see something.
Emile
Not a good idea it seems, formatting not allowed here, I'll add it to the first post.
Emile
Thankyou so much for your time. I have found the solution thanks to your posting of this on your website. It's been added as a solution on the thread. I can't thank you enough! This has been bugging me for about 8 hours.
Emile
I'm having trouble implementing this script, could you please explain?
Emile
What kind of trouble? You have to copypaste it into the header of your HTML file. It will include the "jQuery" JavaScript library and implement a function on the event of loading of the window. This function will affect the items with class=video and id=content. You can debug the function behaviour with FireBug in Firefox or Ctrl-Shift-J in Chrome. Anyway, please tell me what kind of problems you have and I can help you again :)
littlegreen
Sorry for the late reply on this, I have been super busy. I have put the code into the head of the page and left the css and html as it was. What happens: Chrome - works well, Firefox - placement not working (smaller) (no errors in error console) and infinite loading for video, IE - Correct positioning/ scale but infinite loading screen.
Emile
hi emile, no problem, nice that you still followup though. the source code i had worked in Firefox and Chrome, and I had the infinite loading screen in IE. I put some time into the IE issue until I found out that it is a frequently occurring issue with Vimeo and IE. Does IE work in your other page? Could u put the HTML online somewhere?
littlegreen
I have posted new answer, that code should work in IE/Firefox/Chrome. Hope that Opera/Safari work too ^^
littlegreen
Sorry (again_), about being slow on the uptake. Thanks very much for this, I'll check it out.
Emile
A: 

Thankyou very much Erik and littlegreen. I have found the problem. It seems that you can't use a DOCTYPE if you want to do this. I just took out the Doctype and xmlns it worked. Wierd but effective.

Emile
???? that is indeed rather weird! Anyhow, glad, you got it to work :)
littlegreen
I've run the code through the W3C validators with several doctypes, nothing comes up.. the solution still feels very 'icky' to me, what if some future browser decides to guess the standard doctype differently? I've edited my solution to suggest a Javascript approach that would be independent of Doctype. Ugly, but it'll probably work.
littlegreen
update: it works!
littlegreen
Great, will try this. Thanks.
Emile
A: 

Here is a jQuery solution that works with multiple doctypes and in Chrome, Firefox and IE. IE will possibly show a blank page, but this is a Vimeo issue and can be solved by updating the IE flash plugin as discussed here and very extensively here.

I have also placed the code online.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<head>
<title>Vimeo test</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"&gt;&lt;/script&gt;
<script language="JavaScript" type="text/javascript">

    jQuery(function($){
        $(window).load(function() {
            var h = $(window).height() * 0.9;
            var w = $("#content").width();
            $(".video").width(w);
            $(".video").height(h);
            $("#content").css('visibility', 'visible');
        });
    });

</script>
<style type="text/css">

#container {
    width:100%;
    height:100%;
}

#content {
    margin-left: 350px;
    margin-right: 0px;
    visibility: hidden;
}

</style>
</head>
<body>

<div id="container">
    <div id="content">
        <object class="video" width="400" height="225">
            <param name="allowfullscreen" value="true" />
            <param name="allowscriptaccess" value="always" />
            <param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=8808526&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" />
            <embed class="video" src="http://vimeo.com/moogaloop.swf?clip_id=8808526&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"></embed>
        </object>
    </div>
</div>

</body>
</html>
littlegreen
Your an absolute legend! Thanks, it works.
Emile
Cool. Welcome to the wonderful world of Stack Overflow :-)
littlegreen