How to Make a "Double Arrow" with CSS3 Content Technique

Is it possible to make a double arrow with css3 content technique?

With one element, you could do it using gradients and skewed pseudo-elements for a link:

demo

(you could actually do it using just gradients, but then a hover action won't be triggered on hover on the arrow shape itself, but on hover on the rectangular element containing it)

HTML:

<a class='boo' href='#'>click me</a>

Relevant CSS:

.boo {
display: inline-block;
position: relative;
padding: .5em 2em;
background:
linear-gradient(60deg, dodgerblue 50%, transparent 50%) 100% 0,
linear-gradient(-60deg, transparent 50%, dodgerblue 50%) 100% 100%,
linear-gradient(-90deg, transparent 1em, dodgerblue 1em);
background-repeat: no-repeat;
background-size: 1em 50%, 1em 50%, 100% 100%;
}
.boo:before, .boo:after {
position: absolute;
right: -.2em;
width: .5em; height: 50%;
background: dodgerblue;
content: '';
}
.boo:before {
top: 0;
transform: skewX(30deg);
}
.boo:after {
bottom: 0;
transform: skewX(-30deg);
}

EDIT:

If your background is a solid color, not an image or a gradient, you could do it in a much simpler way, without using gradients (which means that this second method also has the advantage of working in IE9).

demo #2

.boo {
display: inline-block;
position: relative;
padding: .5em 2em;
background: lightblue;
}
.boo:before, .boo:after {
position: absolute;
right: -.3em;
width: .5em; height: 50%;
box-shadow: -.2em 0 0 white;
background: inherit;
content: '';
}
.boo:before {
top: 0;
transform: skewX(30deg);
}
.boo:after {
bottom: 0;
transform: skewX(-30deg);
}

Css double arrow

You may consider pseudo element and rotation like this :

.arrow1 {  height: 120px;  width: 100px;  overflow: hidden;  position: relative;}
.arrow1:before,.arrow1:after { content: " "; position: absolute; width: 60px; height: 60px; background: rgba(0, 128, 0, 0.6); transform: rotate(45deg); left: -30px; top: 40px;}
.arrow1:after { top: 20px;}
<div class="arrow1"></div>

How to create directional two pointed arrow using css?

You can make this using pure css.(Quite easy and simple way which supports all browsers).

HTML

<div class="container">
<span class="arrow-left"></span>
<span class="arrow-right"></span>
</div>

CSS

.container{
width:60%;
height:40px;
background:#ccc;
margin:100px auto;
}
.arrow-right {
width: 0;
height: 0;
border-top: 40px solid transparent;
border-bottom: 40px solid transparent;
border-left: 40px solid #ccc;
float:right;
margin-top:-20px;
margin-right:-40px;
}

.arrow-left {
width: 0;
height: 0;
border-top:40px solid transparent;
border-bottom: 40px solid transparent;
float:left;
border-right:40px solid #ccc;
margin-top:-20px;
margin-left:-40px;
}

Working Fiddle

Fiddle

Update

You can also try to make this with pseudo classes like :before,:after but they have some browser compatibility in IE. (I will not prefer this method but it is an easy way).

two arrows on top of each other with css

Add position: absolute; to your .addbutton class. This way it stays it's place, but allows the next element to be rendered on the same position. Here's your fiddle

How to code an arrow using css

For arrow and lines i have use border

.content {  margin-top: 30px;  position: relative;  border: 2px solid black;  border-bottom: 2px;  border-radius: 5px;  width: 200px;  height: 40px;}
.content:before,.content:after,.center:before { content: ''; width: 0; height: 0; border-width: 8px 8px; border-color: #000 transparent transparent transparent; border-style: solid; position: absolute;}
.content:before { left: -8px; top: 36px;}
.content:after { right: -8px; top: 36px;}
.center:before { right: -8px; top: 60px;}
.center { position: absolute; height: 60px; top: -24px; left: 50%; margin-left:-2px; border: 1px solid black;}
<div class="content">  <div class="center">  </div></div>

How to make this arrow in CSS only?

If the space between the arrows does not need to be transparent (it is solid color) you can use the :before and :after to create the edges (without new elements in DOM)

Basically, it creates rotated squares with the borders we want and places them accordingly

#flowBoxes {    margin:auto;    padding:20px;    min-width:700px;
}#flowBoxes div { display:inline-block; position:relative; height:25px; line-height:25px; padding:0 20px; border:1px solid #ccc; margin-right:2px; background-color:white;}
#flowBoxes div.right:after{ content:''; border-top:1px solid #ccc; border-right:1px solid #ccc; width:18px; height:18px; position:absolute; right:0; top:-1px; background-color:white; z-index:150; -webkit-transform: translate(10px,4px) rotate(45deg); -moz-transform: translate(10px,4px) rotate(45deg); -ms-transform: translate(10px,4px) rotate(45deg); -o-transform: translate(10px,4px) rotate(20deg); transform: translate(10px,4px) rotate(45deg);}
#flowBoxes div.left:before{ content:''; border-top:1px solid #ccc; border-right:1px solid #ccc; width:18px; height:18px; position:absolute; left:0; top:-1px; background-color:white; z-index:50; -webkit-transform: translate(-10px,4px) rotate(45deg); -moz-transform: translate(-10px,4px) rotate(45deg); -ms-transform: translate(-10px,4px) rotate(45deg); -o-transform: translate(-10px,4px) rotate(20deg); transform: translate(-10px,4px) rotate(45deg);}#flowBoxes .active{ background-color:green; color:white;}#flowBoxes div.active:after{ background-color:green;}
<div id="flowBoxes">        <div class="right">Diersoort / I&R</div>        <div class="left right active">Model</div>        <div class="left right">Varianten</div>        <div class="left right">Bedrukkingen</div>        <div class="left">Bevestiging</div></div>

Create a button with double arrows at the end

Note: The approach that is used in the answer that I linked in comments is the best if you have to support all browsers. If IE support is not mandatory then you can use clip paths like in this answer. Could not post this approach in the other thread because its requirements are different and hence adding as answer here.

Using SVG clipPath along with the CSS clip-path property we can create a path such that it cuts out the unwanted portions from the button (the a tag).

Pros:

  • Output is responsive as it is SVG based and can adapt even if the text spans more than a line.
  • Only one element is required unlike three elements (like in the pen that I provided in comments).
  • The cuts are transparent as we are clipping the path and so this will work even when the body or the parent has a non-solid background.

Cons:

  • Lack of support for clip-path in any version of IE including Edge. Support for clip-path in Edge is Under consideration and may get implemented in future.

body {  background: gray;}a {  display: block;  background: rgb(255,126,0);  color: white;  width: 300px;  min-height: 35px;  padding: 4px 5% 4px 4px;  margin-bottom: 10px;  text-decoration: none;  text-transform: uppercase;  font-size: 24px;  -webkit-clip-path: url(#clipper);  clip-path: url(#clipper);}
<svg width="0" height="0">  <defs>    <clipPath id="clipper" clipPathUnits="objectBoundingBox">      <path d="M0,0 0.79,0 0.83,0.5 0.79,1 0.81,1 0.85,0.5 0.81,0 0.86,0 0.9,0.5 0.86,1 0.88,1 0.92,0.5 0.88,0 0.93,0 0.97,0.5 0.93,1 0,1z" />    </clipPath>  </defs></svg><a href="#" class="btn-wrap">  <span class="btn btn-primary">See the proof</span></a>
<a href="#" class="btn-wrap"> <span class="btn btn-primary">See the proof when there is large text</span></a>

How to show an arrow down symbol with CSS

You may use other unicode or use borders :
DEMO

.select:before{
content: "\25be or \25bc ? ";
float:right;
color:gray;
}
.select:after{
content: "";
margin:0 0.5em;
display:inline-block;
border: 7px solid transparent;
border-top:8px solid gray;
border-bottom:0 none;
}

How can I do thing like arrow in design of div?

Creating a triangle as a pseudoelement using borders is one way to do it, but your mockup includes a box-shadow. If you don't want to sacrifice the box-shadow (because using the border technique, it will create a square shadow and look quite bad), there is a way.

Create two pseudoelements styled as absolutely positioned squares, and rotate them 45 degrees. Set just one of them to a lower stacking order than the default (z-index: -1) and apply the box shadow to that element.

Check out the jsFiddle

HTML:

<div class="container"></div>

CSS:

.container:before,
.container:after {
content: '';
width: 2em; height: 2em;
position: absolute; top: -1em; left: 50%;
margin-left: -.5em;
background: green;
-webkit-transform:rotate(45deg);
-moz-transform:rotate(45deg);
-ms-transform:rotate(45deg);
-o-transform:rotate(45deg);
transform:rotate(45deg);
}

.container:before {
-webkit-box-shadow: 0 0 5px black;
-moz-box-shadow: 0 0 5px black;
box-shadow: 0 0 5px black;
z-index: -1;
}

Right banner arrows purely in CSS

So the trick, here, is being able to control the height correctly. Here, I've got the text in a span with a line-height : 0, and padding:15px. Now, we have precisely 30px of height, and can use an ::after pseudo element to fabricate the arrow. The width will be set by the text content, but can be defined with an explicit width rule, as well.

<div class="arrow"><span>text</span></div>

.arrow{
display:inline-block;
height:auto;
background-color:orange;
}

.arrow span{
display:inline-block;
line-height:0;
padding:15px;
color:white;
}

.arrow::after{
width: 0;
height: 0;
position: absolute;
right:0
top: 0;
border-top: 15px solid transparent;
border-bottom: 15px solid transparent;
border-left: 15px solid orange;
content: "";
}

Add whatever colors / hover states you require. You can see some basic rules in the working fiddle.

Fiddle



Related Topics



Leave a reply



Submit