html - 如何使用 CSS 过渡来增加悬停时 Bootstrap 卡片的字体大小?

标签 html css bootstrap-4

我只是想增加 Bootstrap card 类中文本的大小并在 hover 操作时更改其颜色,但我的代码仅更改颜色而不会增加字体大小也不会发生任何过渡。我不是专业的前端开发人员,所以如果您发现我的错误并指出,请原谅我。这是我正在使用的代码

CSS

#team .card {
  border: none;
  border-top-left-radius: 25px;
  border-bottom-right-radius: 25px;
  cursor: pointer;
  color: grey;
  font-size: 1rem;

  transition: font 1s ease-in-out;
}

#team .card:hover {
  font-size: 1.3rem;
  color: white;
}

html

<div class="card bg-dark shadow">
    <div class="card-img-overlay d-flex align-items-end justify-content-end">
        <h6 class="font-weight-normal">
            foo bar 
        </h6>
    </div>
</div>

我应该如何进行过渡?

最佳答案

字体大小由h6标签控制,添加到css中即可解决

#team .card {
  border: none;
  border-top-left-radius: 25px;
  border-bottom-right-radius: 25px;
  cursor: pointer;
  color: grey;
  font-size: 1rem;

  transition: font 1s ease-in-out;
}

#team .card:hover h6 {
  font-size: 1.3rem;
  color: red;
}

关于html - 如何使用 CSS 过渡来增加悬停时 Bootstrap 卡片的字体大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56759155/

相关文章:

javascript - HTML5拖放传输时调整div

jquery - 自动刷新 div 进入下一行

javascript - 悬停到网页框架时的边界图像预览

javascript - 当代码中有 bootstrap.min.js 时,Bootstrap 导航栏下 zipper 接不起作用

javascript - 通过 Bootstrap-Vue + Webpack + Vue.js 使用自定义 SCSS

html - CSS3 媒体查询 - 两种布局

html - 何时为元标记使用属性属性?

css - 使用 Bootstrap 4 Alpha 6 在较小的设备上制作可滚动的居中导航

html - 为文本区域对象中的每一行添加边框

css - 动态图像垂直居中