繁体   English   中英

如何使用 CSS / Bootstrap 3 制作斜线

[英]How to make Oblique lines with CSS / Bootstrap 3

我怎样才能用斜线制作这样的页面?

在此处输入图片说明

例如,我可以将角度设为 20 度吗? 我必须放3个div?

现在我把第一个 div 放在中间一个标志,然后我把导航栏和我希望导航栏与斜线上方的角度对齐。 我必须在引导程序 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/

要么使用带有线性渐变的背景。

带剪辑路径的演示:

 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.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM