html - 如何从此圆形图标中删除黑色边框?

标签 html css

鼠标悬停将背景更改为黑色,但我想删除黑色边框,并将图标设置为圆圈。

.our-activity-div {
  padding: 20px;
  text-align: center;
}

.our-activity-inner {
  width: 33%;
  box-sizing: border-box;
  display: inline-block;
}

.fundraising {
  max-width: 75%;
  min-height: 220px;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
  text-align: center;
  border-radius: 10px;
  margin: 0 auto;
  line-height: 0px;
  padding: 30px 35px;
  box-sizing: border-box;
}

.fundraise-hr {
  width: 25%;
  border-color: #000;
}

.fundraise-padding {
  text-align: left;
  padding-top: 20px;
}

.fundraising-parag {
  padding: 10px 5px;
  line-height: 1.5em;
}

.symbol0 {
  color: #000;
  font-size: 100px;
  position: relative;
  top: -28px;
  border-radius: 50%;
}

.fundraising:hover .fundraise-padding {
  color: #01d262;
}

.fundraising:hover .fundraise-hr {
  border-color: #01d262;
}

.fundraising:hover .symbol0 {
  background-color: #000;
  color: #01d262;
}
<div class="our-activity-div">
  <div class="our-activity-inner">
    <div class="fundraising">
      <span class="symbol0">&#9775;</span>
      <h2 class="fundraise-padding ">Fundraising</h2>
      <hr class="fundraise-hr "></hr>
      <p class="fundraising-parag">
        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
      </p>
    </div>
  </div>
</div>

最佳答案

从 .fundraising:hover .symbol0 中移除 background-color 在 css 中

并使用 pseudo element作为 :after on :hover 并设置演示背景

.our-activity-div {
  padding: 20px;
  text-align: center;
}

.our-activity-inner {
  width: 33%;
  box-sizing: border-box;
  display: inline-block;
}

.fundraising {
  max-width: 75%;
  min-height: 220px;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
  text-align: center;
  border-radius: 10px;
  margin: 0 auto;
  line-height: 0px;
  padding: 30px 35px;
  box-sizing: border-box;
}

.fundraise-hr {
  width: 25%;
  border-color: #000;
}

.fundraise-padding {
  text-align: left;
  padding-top: 20px;
}

.fundraising-parag {
  padding: 10px 5px;
  line-height: 1.5em;
}

.symbol0 {
  color: #000;
  font-size: 100px;
  position: relative;
  top: -28px;
  border-radius: 50%;
}

.fundraising:hover .fundraise-padding {
  color: #01d262;
}

.fundraising:hover .fundraise-hr {
  border-color: #01d262;
}

.fundraising:hover .symbol0 {
  color: #01d262;
}

.fundraising:hover .symbol0:after {
  content: '';
  background-color: #000;
  position: absolute;
  width: 80%;
  height: 50%;
  top: 24px;
  z-index: -1;
  left: 9px;
  border-radius: 50%;
}
<div class="our-activity-div">
  <div class="our-activity-inner">
    <div class="fundraising">
      <span class="symbol0">&#9775;</span>
      <h2 class="fundraise-padding ">Fundraising</h2>
      <hr class="fundraise-hr "></hr>
      <p class="fundraising-parag">
        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
      </p>
    </div>
  </div>
</div>

关于html - 如何从此圆形图标中删除黑色边框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57352970/

相关文章:

css - 将第 n 个 child 应用于单个类(class)。

javascript - 将这段javascript代码放在哪里才能正常工作

angularjs - 任何人都明白为什么这个 CSS3 动画在 Angularjs 更改类时不起作用?

html - 如何管理多个 HTML 电子邮件模板而不失去理智?

css - 在 float 元素中间对齐图像,获取父元素高度

html - Angular 6/7 css 媒体查询不适用于孙子

php - 无法在 session 中存储用户 ID

javascript - CSS ul 受到另一个 ul 的影响

python - 为什么 django 在模板的注释 block 中发现错误?

HTML。当同一区域有 2x onclick 事件时