国旗星在某些浏览器中显示不正确

时间:2019-06-30 04:23:24

标签: html css

标志上的星星在某些浏览器中显示不规则。我一直在尝试通过更改一些CSS代码和HTML来修复它,但没有任何效果。在我的浏览器中看起来还不错。我试着在星星上加上\ br \,以使每行停顿一下,但这无济于事。

  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100vh;
  margin: 0;
  padding: 0;
  width: 100vw;
  font-size: 1.5vmin;
}

.container {
  display: flex;
  height: 100vh;
  width: 100vw;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.american-flag {
  height: 26rem;
  width: 53rem;
  background-color: #B31C31;
  font-size: 1rem;
}

.american-flag:before {
  content: '';
  height: 2rem;
  margin-top: 2rem;
  width: 53rem;
  display: inline-block;
  background-color: #fff;
  box-shadow: 0 4rem 0 white,
              0 8rem 0 white,
              0 12rem 0 white,
              0 16rem 0 white,
              0 20rem 0 white;
}

.american-flag:after {
  align-items: center;
  content: '★ ★ ★ ★ ★ ★ \00a0\200a ★ ★ ★ ★ ★ \00a0\200b ★ ★ ★ ★ ★ ★ \00a0\200a ★ ★ ★ ★ ★ \00a0\200b ★ ★ ★ ★ ★ ★ \00a0\200a ★ ★ ★ ★ ★ \00a0\200b ★ ★ ★ ★ ★ ★ \00a0\200a ★ ★ ★ ★ ★ \00a0\200b ★ ★ ★ ★ ★ ★';
  display: flex;
  justify-content: center;
  position: relative;
  height: 14.1rem;
  margin-top: -4.3rem;
  width: 20.75rem;
  background: #39386E;
  color: #fff;
  font-size: 2rem;
  letter-spacing: .5rem;
  line-height: 1.55rem;
  text-align: center;
}

.btn-container {
  position: relative;
  text-align: center;
}

.btn {
  height: 4rem;
  width: 30rem;
  background: #fff;
  border: #B31C31 solid 0.125rem;
  border-radius: 0.625rem;
  color: #39386E;
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  margin-top: 3rem;
}

.btn:hover {opacity: 0.6}


#stage {
  position: relative;
  height: 100vh;
  width: 100vw;
  background-color: #000028;
}

这是它在某些浏览器中的显示方式:

Screenshot of the issue

我正在使用Mac,它可以在Chrome和Safari中显示我想要的方式。在Windows PC上的Chrome中拔起时,星星会乱七八糟。这是指向Codepen Codepen Project

的链接

1 个答案:

答案 0 :(得分:0)

将“#american-flag :: after”的字体大小更改为“ 2.2rem”。应该可以。

我想知道为什么您不能使用图像(最好是SVG)。

相关问题