Hello how could i add to a pseudo-element gradient effect from left to right. i'm trying:
.divider p:after {
content: "";
position: absolute;
top: 50%;
left: 0;
right: 25%;
z-index: -1;
border-top: 1px solid #666666;
}
HTML
<div class="divider">
<p><span>Featured</span></p>
</div><!-- end of divider -->
above code draws a sharp line,but i would like create something like this:
my whole code was:
.divider {
color: #666666;
}
.divider p span {
margin:0;padding: 0 10px;
background: #FFFFFF;
display: inline-block;
}
.divider p {
padding-left: 20px;
position: relative;
z-index: 2;
}
.divider p:after {
content: "";
position: absolute;
top: 50%;
left: 0;
right: 25%;
z-index: -1;
border-top: 1px solid #666666;
}
.box:before,
.box:after {
content: "";
position: absolute;
display: block;
left: -10px;
width: 1px;
height: 50%;
}
.box:before {
top: 0;
background: linear-gradient(to top, #333 0%, transparent 100%);
}
.box:after {
bottom: 0;
background: linear-gradient(to bottom, #333 0%, transparent 100%);
}
In response to Bergmann's question to the original answer:
You could simulate solid gradient borders with little extra css.
HTML:
<div class="element">
<div class="content">
Content
</div>
</div>
CSS:
.element {
position: relative;
padding: 5px;
}
.element:before {
content: '';
position: absolute;
top: 0;
right: 0;
left: 0;
height: 100%;
background-image: linear-gradient(90deg, #000 0%, #fff 100%);
}
.content {
position: relative;
background-color:white;
}
http://jsfiddle.net/nu9zmxvw/
In this sample the .element padding is used to simulate border.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With