如何用 CSS / Bootstrap 制作斜线 3

How to make Oblique lines with CSS / Bootstrap 3

我怎样才能制作出这样带有斜线的页面?

我可以放一个20度角吗?我必须放 3 div?

现在我先放一个div在中间放一个标志,然后放导航栏,我希望导航栏与斜线正上方的角度对齐。 我必须工作 bootstrap 3 我有点迷路了。非常感谢您的帮助和解释

<div class="container" style="background-color: #04342E; width:100%">
            <img class="img-responsive center-block" style="height: 600px; align-items: center;"; src="/i/gp-logo.png" />
 <nav class="navbar navbar-default" style="justify-content: space-between; background-color: transparent; background: transparent; border-color: transparent;">
                <ul class="nav navbar-nav" style="text-decoration: none">
                    <li class="nav-item">
                      <a class="nav-link active" href="#" style="color: white;">Accueil</a>
                    </li>
                    <li class="nav-item">
                      <a class="nav-link" href="#" style="color: white;">Tableaux</a>
                    </li>
                    <li class="nav-item">
                      <a class="nav-link" href="#" style="color: white;">Papeterie</a>
                    </li>
                     <li class="nav-item">
                      <a class="nav-link" href="#" style="color: white;">Book</a>
                    </li>
                    <li class="nav-item">
                      <a class="nav-link" href="#" style="color: white;">A propos</a>
                    </li>
                    <li class="nav-item">
                      <a class="nav-link" href="#" style="color: white;">Contact</a>
                    </li>
                </ul>
            </nav>
            <div>   
        </div> 
      </div>

你可以用 clip-path 创建 div 我建议使用:https://bennettfeely.com/clippy/

或者你使用背景 linear-gradient。

DEMO clip-path:

body{
  background: #04342E;
  margin:0;
}
div.polygon{
  height: 100vh;
  width: 100vw;
  background: white;
  clip-path: polygon(0 25%, 100% 0, 100% 100%, 0 75%);
  
  display:flex;
}

.content{
  height: 50%;
  width: 100%;
  background-color:rgba(255,0,0,0.3); /** Just used to show the written area But it should be removed **/
  margin:auto;
}
<div class="polygon">
  <div class="content">
   Lorem ipsum
  </div>
</div>

.container {
  background-color: #04342E;
  width: 100%;
  height: 500px;
  position: relative;
}

.container::after {
  position: absolute;
  content: "";
  left: 0px;
  right: 0px;
  bottom: 0px;
  border-bottom: solid white 500px;
  transform-origin: bottom right;
  transform: skew(1000deg);
}

.container #content {
  background-color: #04342E;
  width: 100%;
  height: 500px;
  margin-top: 600px;
  position: relative;
}

.container #content::after {
  position: absolute;
  content: "";
  top: 0px;
  right: 0px;
  left: 0px;
  border-top: solid white 500px;
  transform-origin: top left;
  transform: skew(-1000deg);
}
<div class="container">
  <img class="img-responsive center-block" style="height: 100px; align-items: center;" ; src="./images/image 5.png" />
  <nav class="navbar navbar-default" style="justify-content: space-between; background-color: transparent; background: transparent; border-color: transparent;">
    <ul class="nav navbar-nav" style="text-decoration: none">
      <li class="nav-item">
        <a class="nav-link active" href="#" style="color: white;">Accueil</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#" style="color: white;">Tableaux</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#" style="color: white;">Papeterie</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#" style="color: white;">Book</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#" style="color: white;">A propos</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#" style="color: white;">Contact</a>
      </li>
    </ul>
  </nav>
  <div id="content">
  </div>
</div>

you can use psuedo classes in css to create this. see above for the code.