How to force an element above another - html

I have two slightly overlapping (breadcrumb) elements, side-by-side, and I want to make the one on the left to clip the one on the right. Setting z-index didn't appear to work. Is there a better way?
DEMO:https://plnkr.co/edit/5RCH9hswONT16QJeK3KE?p=preview
.arrow-point {
display: inline-block;
border-top: 12px solid transparent;
border-bottom: 12px solid transparent;
border-left: 15px solid #777;
/* z-index:10; */
}
.arrow-body {
font-family: verdana;
font-size:15px;
display: inline-block;
background-color: #777;
color:white;
padding:2px 6px 2px 20px;
height:20px;
vertical-align:top;
/* z-index:-3; */
}
.arrow-tail {
position: absolute;
display: inline-block;
border-top: 12px solid transparent;
border-bottom: 12px solid transparent;
border-left: 15px solid #FFF;
/* z-index:-2; */
/* margin-left:-6px; */
}
<div style="font-size:0;display:inline-block">
<div class="arrow-tail"></div>
<div class="arrow-body">Submenu A</div>
<div class="arrow-point"></div>
</div>
<div style="font-size:0;float:left;margin-right:-6px;display:inline-block">
<div class="arrow-body">Main Menu</div>
<div class="arrow-point"></div>
</div>

Set position to relative. Than set z-index: 9999.
The position property specifies the type of positioning method used for an element.
.arrow-point {
display: inline-block;
border-top: 12px solid transparent;
border-bottom: 12px solid transparent;
border-left: 15px solid #777;
/* z-index:10; */
}
.arrow-body {
font-family: verdana;
font-size:15px;
display: inline-block;
background-color: #777;
color:white;
padding:2px 6px 2px 20px;
height:20px;
vertical-align:top;
/* z-index:-3; */
}
.arrow-tail {
position: absolute;
display: inline-block;
border-top: 12px solid transparent;
border-bottom: 12px solid transparent;
border-left: 15px solid #FFF;
/* z-index:-2; */
/* margin-left:-6px; */
}
<div style="font-size:0;display:inline-block">
<div class="arrow-tail"></div>
<div class="arrow-body">Submenu A</div>
<div class="arrow-point"></div>
</div>
<div style="font-size:0;float:left;margin-right:-6px;display:inline-block;position: relative;z-index: 9999;">
<div class="arrow-body">Main Menu</div>
<div class="arrow-point"></div>
</div>

Assuming that all these menus are inside a container div, set the parent style to float:left; and have the children float:right. Please ensure that the order must be reversed. Take a look.
.container{
position:relative;
float:left;
}
.container > div{
position: relative;
margin-left: -15px;
z-index: 10;
font-size: 0;
display: inline-block;
float: right;
}
.container > div:last-child{
margin-left:0;
}
.arrow-point {
display: inline-block;
border-top: 12px solid transparent;
border-bottom: 12px solid transparent;
border-left: 15px solid #777;
/* z-index:10; */
}
.arrow-body {
font-family: verdana;
font-size:15px;
display: inline-block;
background-color: #777;
color:white;
padding:2px 6px 2px 20px;
height:20px;
vertical-align:top;
/* z-index:-3; */
}
.arrow-tail {
position: absolute;
display: inline-block;
border-top: 12px solid transparent;
border-bottom: 12px solid transparent;
border-left: 15px solid #FFF;
/* z-index:-2; */
/* margin-left:-6px; */
}
<div class="container">
<div>
<div class="arrow-tail"></div>
<div class="arrow-body">Submenu B</div>
<div class="arrow-point"></div>
</div>
<div>
<div class="arrow-tail"></div>
<div class="arrow-body">Submenu A</div>
<div class="arrow-point"></div>
</div>
<div>
<div class="arrow-body">Main Menu</div>
<div class="arrow-point"></div>
</div>
</div>

Related

Tabs with hidden margin: how to solve? [duplicate]

This question already has answers here:
How to remove the space between inline/inline-block elements?
(41 answers)
Closed 1 year ago.
I am trying to implement tabs in our application. I've got a CSS problem where somehow I am adding padding or magin to the right of every tab-item
See my problem in here: JSFiddle
As you can see in the Fiddle, the first tab-item is currently active. However, there is some padding to the right of the item. Because of this padding/margin, the bottom border starts a few pixels too soon.
What am I doing wrong here?
.tabs2 {
border-bottom: 1px solid red;
}
.tabs2-wrap {
margin-bottom: -1px;
position: relative;
}
.tablist {
transform: translateX(0px);
border: 1px solid red;
border-bottom: none;
border-radius: 4px 4px 0 0;
width: max-content;
}
.tabs2-item {
padding: 0 20px;
height: 40px;
line-height: 40px;
display: inline-block;
position: relative;
border-left: 1px solid red;
/* ** Hacky solution ** */
/* margin-left: -4px; */
}
.tabs2-item:first-child {
border-left: none;
}
.tabs2-isActive {
border-bottom: 1px solid #fff;
color: #409eff;
}
<div class="tabs2">
<div class="tabs2-wrap">
<div class="tablist">
<div class="tabs2-item tabs2-isActive">Algemeen</div>
<div class="tabs2-item">Vertrouwelijk</div>
<div class="tabs2-item">Historie</div>
<div class="tabs2-item">Kaasboer</div>
</div>
</div>
</div>
you try with display flex:
But why does this problem occur?
Because the display inline-block considers empty characters and spaces as part of block;
.tabs2 {
border-bottom: 1px solid red;
}
.tabs2-wrap {
margin-bottom: -1px;
position: relative;
}
.tablist {
transform: translateX(0px);
border: 1px solid red;
border-bottom: none;
border-radius: 4px 4px 0 0;
width: max-content;
display:flex;
}
.tabs2-item {
padding: 0 20px;
height: 40px;
line-height: 40px;
display: inline-block;
position: relative;
border-left: 1px solid red;
/* ** Hacky solution ** */
/* margin-left: -4px; */
}
.tabs2-item:first-child {
border-left: none;
}
.tabs2-isActive {
border-bottom: 1px solid #fff;
color: #409eff;
}
<div class="tabs2">
<div class="tabs2-wrap">
<div class="tablist">
<div class="tabs2-item tabs2-isActive">Algemeen</div>
<div class="tabs2-item">Vertrouwelijk</div>
<div class="tabs2-item">Historie</div>
<div class="tabs2-item">Kaasboer</div>
</div>
</div>
</div>
and other solution: remove white-space from html without flex:
.tabs2 {
border-bottom: 1px solid red;
}
.tabs2-wrap {
margin-bottom: -1px;
position: relative;
}
.tablist {
transform: translateX(0px);
border: 1px solid red;
border-bottom: none;
border-radius: 4px 4px 0 0;
width: max-content;
display:flex;
}
.tabs2-item {
padding: 0 20px;
height: 40px;
line-height: 40px;
display: inline-block;
position: relative;
border-left: 1px solid red;
/* ** Hacky solution ** */
/* margin-left: -4px; */
}
.tabs2-item:first-child {
border-left: none;
}
.tabs2-isActive {
border-bottom: 1px solid #fff;
color: #409eff;
}
<div class="tabs2">
<div class="tabs2-wrap">
<div class="tablist">
<div class="tabs2-item tabs2-isActive">Algemeen</div><div class="tabs2-item">Vertrouwelijk</div><div class="tabs2-item">Historie</div><div class="tabs2-item">Kaasboer</div>
</div>
</div>
</div>
Looking at your CSS, you have the left and right padding on all tabs2-item elements set to 20px. Then the CSS under the first-child selector turns off the padding to the left of the first tabs2-item element (leaving the padding on the right).

How can I create a foldable ribbon?

I'm looking for a way to program a foldable ribbon. So I've this code here:
.ribbon {
position: absolute;
top: 20px;
right: 0;
padding: 15px;
}
.ribbon-content {
position: relative;
width: 100%;
height: 100px;
border: 1px solid #DDD;
}
.ribbon.base {
background: #666666;
color: #fff;
border-right: 5px solid #666666;
}
.ribbon.light {
background: #ecf0f1;
color: #2c3e50;
border-right: 5px solid #dde4e6;
}
.ribbon.dark {
background: #131313;
color: #fff;
border-right: 5px solid #464646;
}
.ribbon.base-alt {
background: #9cd70e;
color: #fff;
border-right: 5px solid #c6f457;
}
.ribbon.red {
background: #e91b23;
color: #fff;
border-right: 5px solid #f2787d;
}
.ribbon.orange {
background: #ff8a3c;
color: #fff;
border-right: 5px solid #ffc7a2;
}
.ribbon.yellow {
background: #ffd800;
color: #fff;
border-right: 5px solid #ffe866;
}
.ribbon:before,
.ribbon:after {
content: '';
position: absolute;
left: -9px;
border-left: 10px solid transparent;
}
.ribbon:before {
top: 0;
}
.ribbon:after {
bottom: 0;
}
.ribbon.base:before {
border-top: 27px solid #666666;
}
.ribbon.base:after {
border-bottom: 27px solid #666666;
}
.ribbon.light:before {
border-top: 27px solid #ecf0f1;
}
.ribbon.light:after {
border-bottom: 27px solid #ecf0f1;
}
.ribbon.dark:before {
border-top: 27px solid #131313;
}
.ribbon.dark:after {
border-bottom: 27px solid #131313;
}
.ribbon.base-alt:before {
border-top: 27px solid #9cd70e;
}
.ribbon.base-alt:after {
border-bottom: 27px solid #9cd70e;
}
.ribbon.red:before {
border-top: 27px solid #e91b23;
}
.ribbon.red:after {
border-bottom: 27px solid #e91b23;
}
.ribbon.orange:before {
border-top: 27px solid #ff8a3c;
}
.ribbon.orange:after {
border-bottom: 27px solid #ff8a3c;
}
.ribbon.yellow:before {
border-top: 27px solid #ffd800;
}
.ribbon.yellow:after {
border-bottom: 27px solid #ffd800;
}
.ribbon span {
display: block;
font-size: 16px;
font-weight: 600;
}
<div class="container bootstrap snippet">
<div class="row mb-20">
<div class="col-md-3">
<div class="ribbon-content">
<div class="ribbon base"><span>New: I'm a new feature.</span></div>
</div>
</div>
</div>
</div>
Now I need to change it somehow to only show the word New. When I hover now the word, the ribbon should fold out to the left until the whole text is visible. When I leave the ribbon now, it should fold back in.
Is this possible with a smooth animation? I need to be sure the the whole ribbon get's fold out because the length of the text can be different.
I would simplify your code like below then it should be easy to manage using a width animation:
.ribbon {
--c:red; /* Color */
--s:20px; /* Size */
--p:10px; /* padding*/
padding:var(--p);
border-left:calc(var(--s)/2) solid transparent;
display:inline-block;
background:
linear-gradient(to top right,transparent 48%,var(--c) 50%) border-box,
linear-gradient(to bottom right,transparent 48%,var(--c) 50%) border-box,
var(--c) padding-box;
background-size:var(--s) 100%;
background-repeat:no-repeat;
color:#fff;
margin-bottom:5px;
}
.ribbon > span {
display:inline-block;
white-space:nowrap;
max-width:0px;
transition:0.3s all;
overflow:hidden;
vertical-align:bottom;
}
.ribbon:hover > span {
display:inline-block;
white-space:nowrap;
max-width:180px;
transition:1s all;
}
body {
text-align:right;
}
<div class="ribbon">
NEW:<span> Some text here</span>
</div>
<br>
<div class="ribbon" style="--c:blue;--s:25px">
NEW: <span>Some long long text here</span>
</div>
<br>
<div class="ribbon" style="--c:purple;--s:45px;--p:15px">
NEW: <span>text</span>
</div>
<br>
If you're not looking for a curl effect, I think this might help you out.
.ribbon {
position: absolute;
top: 20px;
right: 0;
padding: 15px;
transform: translate3d(145px, 0, 0);
transition: transform 300ms;
}
.ribbon-content {
position: relative;
width: 100%;
height: 100px;
border: 1px solid #DDD;
overflow: hidden;
}
.ribbon-content:hover .ribbon {
transform: translate3d(0, 0, 0);
}
.ribbon.base {
background: #666666;
color: #fff;
border-right: 5px solid #666666;
}
.ribbon.light {
background: #ecf0f1;
color: #2c3e50;
border-right: 5px solid #dde4e6;
}
.ribbon.dark {
background: #131313;
color: #fff;
border-right: 5px solid #464646;
}
.ribbon.base-alt {
background: #9cd70e;
color: #fff;
border-right: 5px solid #c6f457;
}
.ribbon.red {
background: #e91b23;
color: #fff;
border-right: 5px solid #f2787d;
}
.ribbon.orange {
background: #ff8a3c;
color: #fff;
border-right: 5px solid #ffc7a2;
}
.ribbon.yellow {
background: #ffd800;
color: #fff;
border-right: 5px solid #ffe866;
}
.ribbon:before,
.ribbon:after {
content: '';
position: absolute;
left: -9px;
border-left: 10px solid transparent;
}
.ribbon:before {
top: 0;
}
.ribbon:after {
bottom: 0;
}
.ribbon.base:before {
border-top: 27px solid #666666;
}
.ribbon.base:after {
border-bottom: 27px solid #666666;
}
.ribbon.light:before {
border-top: 27px solid #ecf0f1;
}
.ribbon.light:after {
border-bottom: 27px solid #ecf0f1;
}
.ribbon.dark:before {
border-top: 27px solid #131313;
}
.ribbon.dark:after {
border-bottom: 27px solid #131313;
}
.ribbon.base-alt:before {
border-top: 27px solid #9cd70e;
}
.ribbon.base-alt:after {
border-bottom: 27px solid #9cd70e;
}
.ribbon.red:before {
border-top: 27px solid #e91b23;
}
.ribbon.red:after {
border-bottom: 27px solid #e91b23;
}
.ribbon.orange:before {
border-top: 27px solid #ff8a3c;
}
.ribbon.orange:after {
border-bottom: 27px solid #ff8a3c;
}
.ribbon.yellow:before {
border-top: 27px solid #ffd800;
}
.ribbon.yellow:after {
border-bottom: 27px solid #ffd800;
}
.ribbon span {
display: block;
font-size: 16px;
font-weight: 600;
}
<div class="container bootstrap snippet">
<div class="row mb-20">
<div class="col-md-3">
<div class="ribbon-content">
<div class="ribbon base"><span>New: I'm a new feature.</span></div>
</div>
</div>
</div>
</div>
You could get this easily done by wrapping the text after 'new' inside a div and do some changes to your css:
Wrap ': I'm a new feature.' inside <div class="infotext"></div>
Change display for .ribbon span from block to flex
Add css rules for your new class .Infotext like in the example below
The hover gets animated by the css-property transition. With all we tell it to animate everything and to do it in 0.5s.
To learn mor about transition take a look at this
documentation.
The text gets hidden by max-witdh: 0; and gets displayed by max-width: 300px.
I'm using max-width instead of width, becaus with that we dont have to
know the width of each ribbons infotext. To learn more about max-width click here
Feel free to ask me per comment, if anything is unclear.
Working example:
.ribbon {
position: absolute;
top: 20px;
right: 0;
padding: 15px;
}
.ribbon-content{
position: relative;
width: 100%;
height: 100px;
border: 1px solid #DDD;
}
.ribbon.base {
background: #666666;
color: #fff;
border-right: 5px solid #666666;
}
.ribbon.light {
background: #ecf0f1;
color: #2c3e50;
border-right: 5px solid #dde4e6;
}
.ribbon.dark {
background: #131313;
color: #fff;
border-right: 5px solid #464646;
}
.ribbon.base-alt {
background: #9cd70e;
color: #fff;
border-right: 5px solid #c6f457;
}
.ribbon.red {
background: #e91b23;
color: #fff;
border-right: 5px solid #f2787d;
}
.ribbon.orange {
background: #ff8a3c;
color: #fff;
border-right: 5px solid #ffc7a2;
}
.ribbon.yellow {
background: #ffd800;
color: #fff;
border-right: 5px solid #ffe866;
}
.ribbon:before, .ribbon:after {
content: '';
position: absolute;
left: -9px;
border-left: 10px solid transparent;
}
.ribbon:before {
top: 0;
}
.ribbon:after {
bottom: 0;
}
.ribbon.base:before {
border-top: 27px solid #666666;
}
.ribbon.base:after {
border-bottom: 27px solid #666666;
}
.ribbon.light:before {
border-top: 27px solid #ecf0f1;
}
.ribbon.light:after {
border-bottom: 27px solid #ecf0f1;
}
.ribbon.dark:before {
border-top: 27px solid #131313;
}
.ribbon.dark:after {
border-bottom: 27px solid #131313;
}
.ribbon.base-alt:before {
border-top: 27px solid #9cd70e;
}
.ribbon.base-alt:after {
border-bottom: 27px solid #9cd70e;
}
.ribbon.red:before {
border-top: 27px solid #e91b23;
}
.ribbon.red:after {
border-bottom: 27px solid #e91b23;
}
.ribbon.orange:before {
border-top: 27px solid #ff8a3c;
}
.ribbon.orange:after {
border-bottom: 27px solid #ff8a3c;
}
.ribbon.yellow:before {
border-top: 27px solid #ffd800;
}
.ribbon.yellow:after {
border-bottom: 27px solid #ffd800;
}
.ribbon span {
display: flex;
font-size: 16px;
font-weight: 600;
}
.ribbon .infotext {
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s;
max-width: 0;
white-space: nowrap;
overflow: hidden;
}
.ribbon:hover .infotext {
max-width: 300px;
}
<div class="container bootstrap snippet">
<div class="row mb-20">
<div class="col-md-3">
<div class="ribbon-content">
<div class="ribbon base"><span>New<div class="infotext">: I'm a new feature.</div></span></div>
</div>
</div>
</div>
</div>
Try JqueryUI for the animation effect. I havn't tested it, but probably this will give you the idea.
<div class="container bootstrap snippet">
<div class="row mb-20">
<div class="col-md-3">
<div class="ribbon-content">
<div class="ribbon base"><span class='newSpn'>New:</span><span class='content'> I'm a new feature.</span></div>
</div>
</div>
</div>
</div>
$('.newSpn').mouseenter(function(){
$('.content').show('slide', {direction: 'left'}, 1000);
}).mouseleave(function(){
$('.content').hide('slide', {direction: 'right'}, 1000);
});
It requires the jQuery-ui library. See http://www.jqueryui.com

how to make triangle div?

I want to make div like triangle. I describe clear my question by images in blow.
my code is:
<div class="rest_pack">
<img width="100%" src="<?= Yii::$app->request->baseUrl . '/files/upload/3.png' ?>">
<div class="row side_info">
<div class="top">
ساندویچ مخصوص
</div>
<div class="bottom">
5,500
تومان
</div>
</div>
</div>
css:
.rest_pack .side_info{
position: absolute;
width: 100%;
background-color: #FFF;
top: 100px;
opacity: 0.8;
}
.rest_pack .side_info .top{
text-align: center;
font-weight: bold;
font-size: 17px;
color: #3131AA;
padding-top:5px;
}
.rest_pack .side_info .bottom{
text-align: center;
font-weight: bold;
font-size: 16px;
color: #F63440;
padding-top:5px;
}
The result is:
but I want something like this.
I want to make red DIV.
Got it from CSS Tricks https://css-tricks.com/snippets/css/css-triangle/
<div class="arrow-up"></div>
<div class="arrow-down"></div>
<div class="arrow-left"></div>
<div class="arrow-right"></div>
CSS goes here :
.arrow-up {
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 5px solid black;
}
.arrow-down {
width: 0;
height: 0;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
border-top: 20px solid #f00;
}
.arrow-right {
width: 0;
height: 0;
border-top: 60px solid transparent;
border-bottom: 60px solid transparent;
border-left: 60px solid green;
}
.arrow-left {
width: 0;
height: 0;
border-top: 10px solid transparent;
border-bottom: 10px solid transparent;
border-right:10px solid blue;
}
Just change values and you get whatever Triangle you want
You can do it using :after selector and border-left, border-bottom to adjust triangle as you need.
like this:
.title{
position: absolute;
padding:25px;
bottom:0;
right:0;
z-index:1;
}
div {
position: relative;
width: 500px;
height: 300px;
background-image: url("http://i.stack.imgur.com/ys1Jo.png");
}
div:after {
position: absolute;
content: '';
width: 0;
height: 0;
bottom: 0;
border-left: 500px solid transparent;
border-bottom: 130px solid rgb(0, 114, 255);
-moz-transform: scale(0.999);
-webkit-backface-visibility: hidden;
}
<div class="test">
<span class="title">Enter Text Here</span>
</div>
Please try below code
HTML
<div class="main">
<a rel="nofollow" href="http://i.stack.imgur.com/ys1Jo.png"><img alt="enter image description here" src="http://i.stack.imgur.com/ys1Jo.png"> </a>
</div>
CSS
.main { border: 1px solid red; border-radius: 5px 0 5px 5px; }

Tab header make transparent border for overlapping border

I have a border around my .tab-content and the same border around active .tabs. I've tried adding a transparent border on the bottom to no avail.
Is there a way to, where two borders overlap, have one override the other? Or is there a better way to accomplish this?
Here's a jsfiddle to show my basic set up.
.tab-content {
height:200px;
width:400px;
background-color: #aaa;
border:1px solid #000;
}
.tabs-container {
height:auto;
width:400px;
background-color:#aaabbb;
}
.tabs {
width:360px;
margin-left:20px;
}
.tab {
display:inline-block;
padding:5px 20px;
}
.tab.active {
border-left:1px solid #000;
border-right:1px solid #000;
border-top:1px solid #000;
border-bottom:transparent;
background-color: #aaa;
}
<div class="tabs-container">
<div class="tabs">
<div class="tab active">This Tab</div>
<div class="tab">That Tab</div>
</div>
</div>
<div class="tab-content">
</div>
You can use a pseudo element to create the bottom border, make it the same color as the background, and position it to cover the dark line.
.tab.active:after {
content: '';
border-bottom: 10px solid #aaa;
position: absolute;
bottom: -1px;
left: 0;
width: 100%;
}
.tab-content {
height:200px;
width:400px;
background-color: #aaa;
border:1px solid #000;
}
.tabs-container {
height:auto;
width:400px;
background-color:#aaabbb;
}
.tabs {
width:360px;
margin-left:20px;
}
.tab {
display:inline-block;
padding:5px 20px;
}
.tab.active {
border-left:1px solid #000;
border-right:1px solid #000;
border-top:1px solid #000;
background-color: #aaa;
position: relative;
}
.tab.active:after {
content: '';
border-bottom:10px solid #aaa;
position: absolute;
bottom: -1px;
left: 0;
width: 100%;
}
<div class="tabs-container">
<div class="tabs">
<div class="tab active">This Tab</div>
<div class="tab">That Tab</div>
</div>
</div>
<div class="tab-content">
</div>
Or just move the whole navbar 1px down.
.tab.active {
border-left:1px solid #000;
border-right:1px solid #000;
border-top:1px solid #000;
background-color: #aaa;
position: relative;
bottom: -1px;
}
.tab-content {
height:200px;
width:400px;
background-color: #aaa;
border:1px solid #000;
}
.tabs-container {
height:auto;
width:400px;
background-color:#aaabbb;
}
.tabs {
width:360px;
margin-left:20px;
}
.tab {
display:inline-block;
padding:5px 20px;
}
.tab.active {
border-left:1px solid #000;
border-right:1px solid #000;
border-top:1px solid #000;
background-color: #aaa;
position: relative;
bottom: -1px;
}
/* .tab.active:after {
content: '';
border-bottom:10px solid #aaa;
position: absolute;
bottom: -1px;
left: 0;
width: 100%;
} */
<div class="tabs-container">
<div class="tabs">
<div class="tab active">This Tab</div>
<div class="tab">That Tab</div>
</div>
</div>
<div class="tab-content">
</div>

Arrow not showing properly in CSS

I am trying to achieve the arrow pointing downwards...
right now its showing as trapezium there is some problem in CSS arrow code...
providing my code below.....
Output
https://docs.google.com/file/d/0B3IBJKENGE7RRFR1WHZDYTF6LTQ/edit
<div class="icon__controls__controls">
<div><i class="zoom-out"></i>
<i class="icon-threesixty"></i>
</div>
</div>
CSS :
.icon__controls__controls {
float: left;
display: block;
margin-right: 2.1276595745%;
width: 36.170212766%;
margin-left: 38.2978723404%;
margin-top: 10px;
margin-bottom: 30px;
text-align: center;
}
.icon__controls__controls:last-child {
margin-right: 0;
}
.icon__controls__controls [class^=icon-] {
font-size: 20px;
font-size: 1.25rem;
display: inline-block;
vertical-align: baseline;
zoom: 1;
*display: inline;
*vertical-align: auto;
color: #666;
margin: 0 5px;
vertical-align: top;
}
.icon__controls__controls .zoom-out {
color: red;
}
.icon__controls__controls:after {
display: none;
content: '';
z-index: 3;
border: 50px solid transparent;
/* border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 5px solid black; */
}
.icon__controls__controls:after {
border-top-color: #ef6f00;
}
.icon__controls__controls.active:after {
display: block;
}
LIVE DEMO
This as basically all what you need to understand how it works:
STYLE:
.arrow{
width:20px;
height:20px;
position:relative;
}
.arrow:before{
content:'';
position:absolute;
top:0;
left:0;
width:0;
height:0;
border-left:20px solid transparent;
border-right:20px solid transparent;
border-bottom:0px solid transparent;
border-top:20px solid orange;
}
HTML:
<div class=arrow><div>
if you want it to point up just switch topand bottom
border-top:0px solid transparent;
border-bottom:20px solid orange;
Same for leftand right.
I hope this will help you understanding how arrow are created.
Basic sample :
<div class="arrowBorder"></div>
.arrowBorder {
height : 0px;
width : 0px;
border-top: 50px solid red;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
}
http://jsbin.com/qusecu/4/watch?html,css,output
see more - CSS clipping or masking
You should find the below bit more simpler
css
.arrow{
box-sizing:border-box;
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
-o-box-sizing:border-box;
-ms-box-sizing:border-box;
width:20px;
height:20px;
position:relative;
border-left:20px solid transparent;
border-right:20px solid transparent;
border-bottom:20px solid transparent;
border-top:20px solid orange;
}
html
<div class=arrow><div>