html - 在圆圈/圆盘周围放置边框,其中包含带有 css 的文本

标签 html css css-shapes

使用 CSS,我有一个将文本放置在圆圈/圆盘中的显示。

这是我的例子:

enter image description here

但我很难在圆圈/圆盘周围放置红色边框。

我已经搜索过 SO & Google,查看了大量示例,但我无法将我的 css 类代码配置为具有边框。

希望有人能给出答案。

这是我的 html:

span.circle_standard {
  background: #000;
  border-radius: 3em;
  -moz-border-radius: 3em;
  -webkit-border-radius: 3em;
  color: #fff;
  display: inline-block;
  font-size: 20px;
  font-weight: bold;
  line-height: 6em;
  margin-bottom: 2px;
  text-align: center;
  width: 6em;
}
<div class="col-md-4 padding-bottom-10" dir="ltr" style="direction: ltr; background-color: yellow; text-align: center;">
  <div class="row">
    <span class="circle_standard" dir="ltr" style="direction: ltr;">WWWWW</span>
  </div>
  <div class="row">
    <b>Descriptive Details Here</b>
  </div>
</div>

最佳答案

您可以使用 box-shadow property这样做:

span.circle_standard {
  background: #000;
  border-radius: 3em;
  -moz-border-radius: 3em;
  -webkit-border-radius: 3em;
  color: #fff;
  display: inline-block;
  font-size: 20px;
  font-weight: bold;
  line-height: 6em;
  margin-bottom: 2px;
  text-align: center;
  width: 6em;
  box-shadow:  0 0 0 4px red;
}
<div class="col-md-4 padding-bottom-10" dir="ltr" style="direction: ltr; background-color: yellow; text-align: center;">
  <div class="row">
    <span class="circle_standard" dir="ltr" style="direction: ltr;">WWWWW</span>
  </div>
  <div class="row">
    <b>Descriptive Details Here</b>
  </div>
</div>

关于html - 在圆圈/圆盘周围放置边框,其中包含带有 css 的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35369036/

相关文章:

css - 网格系统 - 不同高度的面板

css - 更改由 :after pseudo-element as its parent? 创建的 CSS 形状的颜色

javascript - CSS Canvas 和导航栏定位

html - float 元素有上边距

html - 在 Chrome Dev Tools 中模拟移动设备时,HTML 和正文的大小如何处理?

css - Chrome 中蓝色焦点轮廓的默认样式是什么?

javascript - 我怎么知道我的内容是否垂直占据了整个页面?

javascript - jQuery:选择 tr 使所有 td 动态匹配过滤条件

javascript - 以内圆和外圆为界的三 Angular 形

CSS 自定义形状