html - 如何使用 CSS 和 HTML 将文本添加到圆圈上?

标签 html css

Right now this is my timer

I want the timer to look like the picture below with the word "Stop"

上面是我的计时器当前的样子。 我想将“停止”一词添加到我的计时器中,但我不知道如何操作。 请记住,它实际上是一个带有类型文本的输入,其中文本就是时间本身。我想在时间之上添加“停止”一词。 HTML 代码:

<input type="text" name="" value="Start" id="">

CSS 代码:

  input[type=text]:focus {
  height: 150px;
  width: 150px;
  background-color:  white;
  caret-color: transparent;
  border-radius: 50%;
  display: inline-block;
  border: none;
  border-style: none;
  text-align: center;
  font-size: x-large;
  box-shadow: inset 0px 0px 0px 10px #FF8D3A;
}

最佳答案

您可以使用绝对定位:

input[type=text]:focus {
  height: 150px;
  width: 150px;
  background-color: white;
  caret-color: transparent;
  border-radius: 50%;
  display: inline-block;
  border: none;
  border-style: none;
  text-align: center;
  font-size: x-large;
  box-shadow: inset 0px 0px 0px 10px #FF8D3A;
}
input[type=text]:focus + .notice{
display:block;
}

.group {
  position: relative;
}

.notice {
  color: #FF8D3A;
  font-size: 30px;
  position: absolute;
  left: 40px;
  top: 30px;
  display:none;
}
<div class="group">
  <input type="text" name="" value="Start" id="">
  <span class="notice">STOP</span>
</div>

关于html - 如何使用 CSS 和 HTML 将文本添加到圆圈上?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68218093/

相关文章:

html - Bootstrap 3 : Label on top on field and submit button in a form inline

css - Bootstrap - 如何在轮播中使用较小的图片但保持整体尺寸

css - IE8,XHTML,位置 : fixed; and z-index

javascript - Slick Carousel - 容器宽度不起作用

javascript - 将 "value"从 slider 传递到元素,作为属性的参数

html - z-index 到背景? CSS

javascript - 如何检查动态添加的样式标签是否已被浏览器解析?

html - 基于显示宽度的表格列数

javascript - 当 jquery 过滤器没有返回结果时在 div 中显示消息

html - 需要帮助让列堆叠链接 flex 成一行