Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html Css-如何将这个内部div放置在外部div的中心?_Html_Css_Google Chrome - Fatal编程技术网

Html Css-如何将这个内部div放置在外部div的中心?

Html Css-如何将这个内部div放置在外部div的中心?,html,css,google-chrome,Html,Css,Google Chrome,如何将类小图标水平放置在tpt\u框的中心 <div id="tpt_box" style="position: fixed;top:0px;left:2px;background-color: transparent;color:white; z-index: 999; width: 100%;"> <div class="small_icons" style=""> <span class="count" id="mytimer"

如何将类
小图标
水平放置在
tpt\u框
的中心

<div id="tpt_box" style="position: fixed;top:0px;left:2px;background-color: transparent;color:white;
     z-index: 999; width: 100%;">
    <div class="small_icons" style="">
      <span class="count" id="mytimer" >0</span>
      <span class="status" id="status" ></span>
      <span class="refresh" id="refresh" onclick="window.location.reload();" ></span>     
      <span class="chat" id="chat" onclick="chatme();" ></span>      
      <span class="fullscreen" id="myfullscreen" onclick="enterFullScreen();"></span>
      <span class="endcall_btn" id="disconnectcall"></span>
      <!-- Contents -->
      <span class="content_popup" id="content_popup" onclick="content_popup();" ></span>

    </div>         
</div>

0

可能有很多可能的方法来实现预期的结果,最简单的方法是

style=“…;文本对齐:居中;”
添加到外部
div
。 将
style=“display inline:block;”“
添加到内部
div

<div id="tpt_box" style="position: fixed;top:0px;left:2px;background-color: transparent; color: white; z-index: 999; width: 100%; text-align: center">
    <div class="small_icons" style="display: inline-block;">

试试这个

    #tpt_box{
     height: 300px;
     position: fixed;top:0px;left:2px;background-color: transparent;color:white;
     z-index: 999; width: 100%;

   }

   .small_icons{

      postion: absolute;
      top: 50%;
      left: 50%;
   }

就像你提到的那样应用那么,你如何看待内部div?在左侧?是-内部div始终保持在左侧,而不是水平居中。这是!请检查一下!除了
颜色:黑色和
边框:实心1px#000是为了测试目的而更改和添加的。一切都很好