html - 在 div 中间画一个圆

标签 html css angular-ui-bootstrap

我想通过使用 Bootstrap 来实现这种情况:

myImage

所以,基本上我想在那个灰色 div 的中间有一个圆圈。

我写了这段代码,但我不知道我错了什么。

HTML

   <div class="row" style="margin: unset; width: 100%">
       <div class="col-md-1" style="background-color: #E5E5E5; height: 46px; 
          line-height: 46px; text-align: center; opacity: 100%">
            <div class="numberCircleInOut"> 124 </div>
       </div>
       <div class="col-md-11" style="background-color: #FFFFFF; height:46px; 
         line-height: 46px"> Motion timeout 
       </div>
  </div>

CSS

.numberCircleInOut {
  border-radius: 50%;
  height: 38px;
  width: 38px;
  border: 2px solid #484848;
  color: #484848;
 }

有什么想法吗?

最佳答案

col-md-1 或 CSS 更改添加类 d-flex justify-content-centeralign-items-center

.numberCircleInOut {
  border-radius: 50%;
  height: 38px;
  width: 38px;
  border: 2px solid #484848;
  color: #484848;
  display:flex;
  align-items:center;
  justify-content:center;
 }

<div class="row d-flex justify-content-center align-items-center" style="margin: unset; width: 100%">
<div class="col-md-1 py-2 d-flex justify-content-center align-items-center" style="background-color: #E5E5E5;">
    <div class="numberCircleInOut"> 124 </div>
</div>
<div class="col-md-11" style="background-color: #FFFFFF;">
    Motion timeout
</div>

https://jsfiddle.net/lalji1051/j3axm9f6/9/

关于html - 在 div 中间画一个圆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57607595/

相关文章:

html - 在彼此下方的多行上排列文本?

javascript - 如何防止浏览器绘制的 img 不可见?

angularjs - Angular-ui datepicker datepicker 的初始状态未按 datepicker-popup 格式化

javascript - Angular : Remove a specific template from cache

javascript - 网站在所有浏览器中都能正常工作,IE8 除外

HTML/CSS : :after pseudo element overflows parent

javascript - 无法从维基百科 API 获取数据

jquery - 带有 bootstrap 垂直嵌套选项卡的 angularjs 使用 ajax 加载内容

html - 绝对定位的 div 动态扩展到相对父 div 之外

javascript - JS改变部分段落的文字颜色