html - 如何在所有div下方显示文字

标签 html css

我想在所有 div 下面显示一些消息。但是显示在div里面。

我上传我的 css 和 html 代码以及输出快照。

enter image description here

.round .shape{
    background-size: 560px;
    background-position: 0px 2px;
    width: 66px;
    height: 69px;
    background-repeat: no-repeat;
    display: inline-block;
}
.img.shape {
    border: 1px solid #eee;
  }
  .img
  {
    margin-right: 52px;
    margin-top: 20px;
  }
  .shape
{
  background-image: url('../images/diamondshape.jpg'); 

}
<label for="ABC" class="round">
              <div class="img shape" ></div>
<span>A</span>
</label>

最佳答案

把data span改成div可以吗??如果您将该跨度更改为 div 那么它就可以正常工作......试试这个

.round .shape{
    background-size: 560px;
    background-position: 0px 2px;
    width: 66px;
    height: 69px;
    background-repeat: no-repeat;
    display: inline-block;
}
.img.shape {
    border: 1px solid #eee;
  }
  .img
  {
    margin-right: 52px;
    margin-top: 20px;
  }
  .shape
{
  background-image: url('../images/diamondshape.jpg'); 

}
<label for="ABC" class="round">
              <div class="img shape" ></div>
<div>A</div>
</label>

关于html - 如何在所有div下方显示文字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44236357/

相关文章:

html - 为什么文本对齐不会对齐 div 中的文本?

javascript - 如何获取具有相同结构的每个div的图像src?

javascript - 使用 Javascript 中的选项创建动态选择

javascript - 如何在 javascript 中获取 CSS 字体大小?

html - 媒体查询 : not working

javascript - 表格排序,分页脚本问题

javascript - 有没有办法通过变量从对象中获取信息?

javascript - 打印功能不使用 jquery 和 css 打印整个页面

php - 在页面的正中央制作下拉菜单

javascript - 当选择器不存在时如何更改选择器的 css javascript/jquery