我正在试图弄清楚如何说明身体后面的横幅并继续在后台。
但困难的部分是当它进入背景时的环绕(3D效果)。
这是我到目前为止所得到的:https://jsfiddle.net/4v6xLtyf/
<body>
<div class="navbar background-banner">
</div>
<div class="body-content">
<div style="height:1000px" class="container content-block">
<h1 style="text-align: center">My Website</h1>
<div class="navbar navbar-inverse navbar-top navbar-custom-top">
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a>Home</a></li>
<li><a>About Us</a></li>
<li><a>Login</a></li>
</ul>
</div>
</div>
<p>Content goes here</p>
</div>
</div>
</body>
答案 0 :(得分:1)
您可以使用:before
,:after
和border
进行操作,接近您需要的内容可能会添加以下CSS规则:
.navbar-custom-top:before {
content: "";
background-color: transparent;
width: 30px;
height: 50px;
position: absolute;
border-left: 25px solid transparent;
border-top: 31px solid #bb5911;
top: 50px;
left:0;
}
.navbar-custom-top:after {
content: "";
background-color: transparent;
width: 30px;
height: 50px;
position: absolute;
border-right: 25px solid transparent;
border-top: 31px solid #bb5911;
top: 50px;
right: 0;
}
然后玩大小,位置和颜色,以完全符合您的需要。
答案 1 :(得分:0)
更新答案......
我从@ user2570380引用链接做了一个例子。
看看我的link_codpen。
新CSS ,两个新班级 ribbonul
&amp; /***********************/
.ribbonul:before, .ribbonul:after {
content: "";
position: absolute;
display: block;
border-style: solid;
border-color: #BB5911 transparent transparent transparent;
bottom: -1em;
}
.ribbonul:before {
left:0;
border-width: 1em 0 0 1em;
}
.ribbonul:after {
right: 0;
border-width: 1em 1em 0 0;
}
.ribbonoutline:after {
content: "";
position: absolute;
display: block;
background-image: linear-gradient(rgb(234, 115, 29), rgb(255, 168, 0)) !important;
height: 28px;
width: 100%;
margin-top: -10px;
left: 0;
z-index: -9999;
}
html,
body {
background-image: linear-gradient(rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.7)) !important;
background-attachment: fixed;
font-family: Algerian;
}
/* Set padding to keep content from hitting the edges */
.body-content {
padding-bottom: 100px;
padding-left: 15px;
padding-right: 15px;
position:relative;
z-index:1
}
/* Override the default bootstrap behavior where horizontal description lists
will truncate terms that are too long to fit in the left column
*/
.dl-horizontal dt {
white-space: normal;
}
/* Set width on the form input elements since they're 100% wide by default */
input,
select,
textarea {
max-width: 280px;
}
.content-block {
background-color: white;
border-radius: 5px;
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
margin-top: 20px;
margin-bottom: 20px;
padding: 22px;
width: 70%;
margin: auto;
height: 500px;
}
.background-banner {
background-image: linear-gradient(rgb(234, 115, 29), rgb(255, 168, 0)) !important;
margin-top: 150px;
border-radius: 0px;
border: 0px;
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
position: absolute;
width: 100%;
z-index: 0;
}
a {
color: black;
text-decoration: none;
}
a:hover,
a:focus {
color: white;
text-decoration: none;
}
.navbar-custom-top {
background-image: linear-gradient(rgb(234, 115, 29), rgb(255, 168, 0)) !important;
margin-top: 50px;
margin-left: -40px;
margin-right: -40px;
border-radius: 0px;
border: 0px;
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}
.custom-container {
padding-right: 0px;
padding-left: 0px;
margin-right: auto;
margin-left: auto;
}
.navbar-fixed-top,
.navbar-fixed-bottom {
border-top-width: 0px;
border-bottom-width: 0px;
}
.navbar-header {
float: left;
width: 100%;
text-align: center;
}
ul.navbar-nav > li {
display: inline;
}
ul.navbar-nav {
float: none;
margin: 0 auto;
text-align: center;
display: block;
position: relative;
}
.content {
min-height: 1000px;
}
.navbar-inverse .navbar-nav > li > a {
color: black;
margin-left: 50px;
margin-right: 50px;
padding-top: 10px;
padding-bottom: 10px;
font-weight: bold;
font-size: 25px;
border-bottom: 2px solid transparent;
}
.navbar-inverse .navbar-nav > li > a:hover {
color: black;
border-bottom: 2px solid transparent;
border-bottom-color: #fff;
}
.navbar-inverse .navbar-nav > .active > a,
.navbar-inverse .navbar-nav > .active > a:hover,
.navbar-inverse .navbar-nav > .active > a:focus {
color: #000000;
background-color: transparent;
border-bottom: 2px solid transparent;
border-bottom-color: black;
}
/***********************/
/***********************/
/***********************/
.ribbonul:before, .ribbonul:after {
content: "";
position: absolute;
display: block;
border-style: solid;
border-color: #BB5911 transparent transparent transparent;
bottom: -1em;
}
.ribbonul:before {
left:0;
border-width: 1em 0 0 1em;
}
.ribbonul:after {
right: 0;
border-width: 1em 1em 0 0;
}
.ribbonoutline:after {
content: "";
position: absolute;
display: block;
background-image: linear-gradient(rgb(234, 115, 29), rgb(255, 168, 0)) !important;
height: 28px;
width: 100%;
margin-top: -10px;
left: 0;
z-index: -9999;
}
<div class="navbar background-banner">
</div>
<div class="body-content">
<div class="container content-block">
<h1 style="text-align: center">My Website</h1>
<div class="navbar navbar-inverse navbar-top navbar-custom-top">
<div class="navbar-collapse collapse ribbonoutline">
<ul class="nav navbar-nav ribbonul">
<li><a>Home</a></li>
<li><a>About Us</a></li>
<li><a>Login</a></li>
</ul>
</div>
</div>
<p>Content goes here</p>
</div>
</div>
&#13;
data.frame
&#13;