【问题标题】:CSS - how to make the iframe inside the div center aligned and the main div also center?CSS - 如何使 div 中心内的 iframe 对齐并且主 div 也居中?
【发布时间】:2014-04-20 16:19:49
【问题描述】:

如何在这个 div 中心内制作 iframe?现在它显示在左侧 + 主 div 也显示在左侧而不是浏览器的中心。

#video_window { 
/*  width: 100%;
  height: 100%;*/

  width: 850px;
  height: 650px;
  position: fixed; top:0px; left:0px;
  background-color: black;

  overflow: hidden;
  display: none;
  margin: 0 auto;
  padding:1px;
  z-index: 9999;
}

#video_window .video_frame {
  display: none;
  margin-top: 0px;
  margin-bottom: 0px;
/*  margin-left: 10%;
  margin-right: 10%;*/
/*  border: 1px solid #009;  */
}

</style>


<!-- a video screen should be center -->
<div id="video_window" class="video_window" style="
     ">
      <iframe id="video_one" class="video_frame" style="z-index: 0;" width="800" height="600" 
            src="http://www.youtube.com/embed/lVjdlpS_Vzw?rel=0" 
            frameborder="0" allowfullscreen></iframe>

    <iframe id="video_two"  class="video_frame" style="z-index: 0;" width="800" height="600" 
            src="http://www.youtube.com/embed/lVjdlpS_Vzw?rel=0" 
            frameborder="0" allowfullscreen></iframe>

</div>

【问题讨论】:

    标签: javascript jquery html css iframe


    【解决方案1】:

    试试看

    margin: 0 auto;
    

    .video_frame

    【讨论】:

    • 试过但还是不行,都在左边显示。
    猜你喜欢
    • 2013-07-29
    • 2023-03-10
    • 2015-05-28
    • 1970-01-01
    • 1970-01-01
    • 2021-12-11
    • 2014-11-10
    • 1970-01-01
    • 2012-02-13
    相关资源
    最近更新 更多