0

Example of what i want to do right:

enter image description here

I'm trying to create an arrow more like a double arrow. My aim is to have one class for it but I have tried what I know and it's not working.

If anyone can direct me to right way it will be great

.wrapper{
  width: 250px;
  height: 150px;
  background:black;
}
.arrow1{  
  left:0px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 37.5px 0 37.5px 75px;
  border-color: transparent transparent transparent #007bff;
}
<div class="wrapper">
    <div class="arrow1"></div>
</div>

https://jsfiddle.net/7mfquq2y/

Thanks

2

2 Answers 2

3

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>

Sign up to request clarification or add additional context in comments.

Comments

1

Alternatively, applying initial border property values to pseudo-elements, as demonstrated in the code snippet embedded below.

Code Snippet Demonstration:

.wrapper{
  width: 250px;
  height: 150px;
  background:black;
}
.arrow {
  height: 95px;
  position: relative; /* required */
}
.arrow:before, .arrow:after {
  content: "";
  position: absolute;
  left: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 37.5px 0 37.5px 40px;
  border-color: transparent transparent transparent rgba(0, 123, 255, 0.7);
}
.arrow:after {  
  bottom: 0;
}
.arrow:before {
  top: 0;
}
<div class="wrapper">
  <div class="arrow"></div>
</div>

Updated JSFiddle

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.