html - 变换 : Rotate background-color

标签 html css css-transforms

我在转换时遇到问题:在我的一个标题上旋转。我试图使页面的整个上半部分有轻微的倾斜,这包括文本和背景。当我旋转 div 时,它会创建空白区域,而不是用背景色填充其余内容。我想要达到的效果是让蓝色轮廓区域成为相同的红色,因此它从页面左侧扩展到右侧。这是屏幕截图:

enter image description here

这是我的代码:

<div class="container-fluid header">
  <div class="row bottom-align">
    <div class="col-lg-8">
      <h1>Title</h1>
      <h1>Second-Title</h1>
      <h1>Another Title</h1>
    </div>
    <div class="col-lg-4 text-right bottom-align-text">
      <ul class="list-inline">
        <li><i class="fa fa-facebook fa-outline"></i></li>
        <li><i class="fa fa-twitter fa-outline"></i></li>
        <li><i class="fa fa-instagram fa-outline"></i></li>
        <li><i class="fa fa-pinterest fa-outline"></i></li>
        <li><i class="fa fa-envelope fa-outline"></i></li>
      </ul>
    </div>
  </div>
</div>

.header {

  background-color: $red-primary;
  color: $white;
  -ms-transform: rotate(-5deg); /* IE 9 */
  -webkit-transform: rotate(-5deg); /* Safari */
  transform: rotate(-5deg);

}

如有任何建议,我们将不胜感激。

最佳答案

Kevin 在评论中提出的一些建议:

body{
    overflow: hidden;
}
.header {
  background-color: #900;
  color: #fff;
  padding: 0 100px;
  margin: 0 -100px;
  -ms-transform: rotate(-5deg); /* IE 9 */
  -webkit-transform: rotate(-5deg); /* Safari */
  transform: rotate(-5deg);
}
<div class="container-fluid header">
  <div class="row bottom-align">
    <div class="col-lg-8">
      <h1>Title</h1>
      <h1>Second-Title</h1>
      <h1>Another Title</h1>
    </div>
    <div class="col-lg-4 text-right bottom-align-text">
      <ul class="list-inline">
        <li><i class="fa fa-facebook fa-outline"></i></li>
        <li><i class="fa fa-twitter fa-outline"></i></li>
        <li><i class="fa fa-instagram fa-outline"></i></li>
        <li><i class="fa fa-pinterest fa-outline"></i></li>
        <li><i class="fa fa-envelope fa-outline"></i></li>
      </ul>
    </div>
  </div>
</div>

关于html - 变换 : Rotate background-color,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32000240/

相关文章:

html - 加粗链接怎么写才对?

javascript - Google map 地点 ID 查找器 - 无法在 InfoWindow 上突出显示(复制)信息

javascript - History back() 方法返回两次

css - 整个 Google Chrome 浏览器的自定义 CSS

javascript - 无法在一行中对齐单选按钮及其标签

html - 在使用剪辑路径的 svg 矩形元素上重复背景图像

html - skew() 和 skewX() 的区别 skewY()

html - 旋转 float div 旁边的 div

html - IE11 的控制台报告我有多个 body 标签

html - 在旋转的 div 中旋转一个元素