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代码>是为了测试目的而更改和添加的。一切都很好