是否可以将此形状设置为白色边框和透明背景?

时间:2015-03-05 17:10:35

标签: css css-shapes

我想把这个形状透明放在里面,带有白色边框。问题是我不知道如何改变形状的右侧。我想做的就是我在左侧做的事情。

我该怎么做?感谢。

enter image description here

https://jsfiddle.net/2pz0kLd4/

代码:

.arrow-steps {
  width: 128px;
  height: 100px;
  border-top:1px solid white;
  border-left:1px solid white;
  border-bottom:1px solid white;
  margin-right:30px;
  margin-top:30px;
  position: relative;
  display:inline-block;
}
.arrow-steps:after {
  content: '';
  position: absolute;
  top: 0px;
  left: 128px;
  width: 0;
  height: 0;
  border: 50px solid transparent;

}
.arrow-steps:before {
  content: '';
  position: absolute;
  top: 0px;
  left: 128px;
  width: 0;
  height: 0;
  border: 50px solid transparent;
  border-left: 12px solid red;

}

.arrow-steps a{
display:block;
margin-top:36px;
color:white;
}

2 个答案:

答案 0 :(得分:0)

尝试这样的事情:

这是fork

body{
background-color:black;
}

.arrow-steps {
  width: 128px;
  height: 100px;
  border-top:1px solid white;
  border-left:1px solid white;
  border-bottom:1px solid white;
  margin-right:30px;
  margin-left: 20px;
  margin-top:30px;
  position: relative;
  display:inline-block;
}
.arrow-steps:after {
  content: '';
  position: absolute;
  top: 0px;
  left: -12px;
  width: 0;
  height: 0;
  border-top: 50px solid transparent; 
  border-right: 12px solid red; 
  border-bottom: 50px solid transparent;
}

.arrow-steps:before {
  content: '';
  position: absolute;
  top: 0px;
  left: 128px;
  width: 0;
  height: 0;
  border-top: 50px solid transparent; 
  border-left: 12px solid red; 
  border-bottom: 50px solid transparent;
}

.arrow-steps a{
  display:block;
  margin-top:36px;
  color:white;
}

答案 1 :(得分:0)

这是一个基本的解决方案,允许双方都有一个边界(需要改变,因为我还没有响应)

html {
  background: tomato;
}
div {
  height: 60px;
  width: 100px;
  border-top: 2px solid white;
  border-bottom: 2px solid white;
  color: white;
  line-height: 60px;
  position: relative;
  margin: 30px;
  text-align:center;
}
div:before {
  content: "";
  position: absolute;
  height: 42px;
  top: 8px;
  left: -22px;
  width: 42px;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  perspective: 100px;
  transform: rotate(45deg)
}
div:after {
  content: "";
  position: absolute;
  height: 42px;
  top: 8px;
  right: -22px;
  width: 42px;
  border-right: 2px solid white;
  border-top: 2px solid white;
  perspective: 100px;
  transform: rotate(45deg)
}
<div>SOME TEXT</div>