首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用transform:skew获得完美的天际线?

如何使用transform:skew获得完美的天际线?
EN

Stack Overflow用户
提问于 2017-11-02 19:58:58
回答 1查看 70关注 0票数 2

我想知道是否有可能使用transform:skew获得完美的边缘(我想附加一个img,但我不能(1分))

https://ibb.co/g5qODG (没有阴影的图像示例。它看起来仍然像是被咬了。)

目前,它看起来像是一张低分辨率的图像

请在下面找到我当前HTML的摘录。

代码语言:javascript
复制
/***UPS***/

.ups-container {
  z-index: 1;
  position: relative;
  color: #ffffff;
}

.ups-container h4 {
  font-size: 2em;
  letter-spacing: 0.01em;
  color: #ffffff;
  font-weight: 600;
  margin: 1rem 0;
  line-height: 1.2em;
  min-height: 76px;
}

.ups-container p {
  color: #c5b7d9;
  /*text-align: left;*/
}

.ups-container strong {
  color: #fff;
}

.skew:before {
  content: '';
  position: absolute;
  left: 0;
  top: -10vh;
  overflow: visible;
  width: 100%;
  height: 300px;
  background: #360d97;
  background-image: url("https://static.contrado.com/resources/images/2017-9/69479/bg-words-174927.png");
  background-image: url("https://static.contrado.com/resources/images/2017-9/69479/bg-words-174927.png"), linear-gradient(213deg, #360d97 42%, #79149e 89%);
  background-repeat: no-repeat;
  background-position: left bottom;
  z-index: -1;
  -webkit-transform: skewY(-5deg);
  -moz-transform: skewY(-5deg);
  -ms-transform: skewY(-5deg);
  -o-transform: skewY(-5deg);
  transform: skewY(-5deg);
  -webkit-backface-visibility: hidden;
  backface-visibility: initial;
  box-shadow: inset 0 -10px 7px rgba(0, 0, 0, 0.3), 0 -10px 14px 2px rgba(0, 0, 0, 0.3), 0 -4px 14px 3px rgba(0, 0, 0, 0.2);
}
代码语言:javascript
复制
<div class="wrapper-no-inner">
  <div class="ups-container">
    <div class="skew">
      <div class="row center-xxs ups-line-up ">

        Hola!

      </div>
    </div>
  </div>

EN

回答 1

Stack Overflow用户

发布于 2017-11-02 20:23:15

你的代码很好,分辨率的问题是由于长方体的阴影造成的。我刚把它取下来,它看起来很好。我认为你必须从这个开始,如果你需要阴影,只需添加新的html标签并设计它们的样式,就可以获得你设计的功能:

代码语言:javascript
复制
/***UPS***/

.ups-container {
  z-index: 1;
  position: relative;
  color: #ffffff;
}

.ups-container h4 {
  font-size: 2em;
  letter-spacing: 0.01em;
  color: #ffffff;
  font-weight: 600;
  margin: 1rem 0;
  line-height: 1.2em;
  min-height: 76px;
}

.ups-container p {
  color: #c5b7d9;
  /*text-align: left;*/
}

.ups-container strong {
  color: #fff;
}

.skew:before {
  content: '';
  position: absolute;
  left: 0;
  top: -26px;
  width: 110%;
  height: 300px;
  background: #360d97;
  transform: skew(0,-5deg);
}
代码语言:javascript
复制
<div class="wrapper-no-inner">
  <div class="ups-container">
    <div class="skew">
      <div class="row center-xxs ups-line-up ">

        Hola!

      </div>
    </div>
  </div>

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47074757

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档