Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html CSS3创建圆角三角形边元素_Html_Css_Html Lists_Css Shapes - Fatal编程技术网

Html CSS3创建圆角三角形边元素

Html CSS3创建圆角三角形边元素,html,css,html-lists,css-shapes,Html,Css,Html Lists,Css Shapes,我只知道绕道而行。不知道如何创建这种无图像ul li标签。 正如你们所看到的,它并不是完全的三角形:它的顶部和底部边缘有点圆。是否可以用css3创建与下图最相似的内容?如果是,如何进行 提前谢谢你 当然! Chris Coyier为此编写了一个很酷的代码: 您可以使用CSS transform rotate属性和边界半径,在这里,我旋转了一个:after pseudo,它绝对定位于容器元素。而不是使用曲线的边界半径 标记: 首先,你必须定义你的化妆如下: <menu type=list&g

我只知道绕道而行。不知道如何创建这种无图像ul li标签。 正如你们所看到的,它并不是完全的三角形:它的顶部和底部边缘有点圆。是否可以用css3创建与下图最相似的内容?如果是,如何进行

提前谢谢你

当然! Chris Coyier为此编写了一个很酷的代码:

您可以使用CSS transform rotate属性和边界半径,在这里,我旋转了一个:after pseudo,它绝对定位于容器元素。而不是使用曲线的边界半径

标记:

首先,你必须定义你的化妆如下:

<menu type=list>
    <li>home</li> 
    <li>work</li>  
</menu>
演示2:

风格:

menu{
   position:relative;
   width:320px;
   height:40px;
}

li{
    float:left;
    width:50%;
    background-color:red;
    list-style:none;
    position:relative;
    height:54px;
    text-align:center;
    line-height:50px;
    color:white;
}

li:before,li:after{
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    border-radius: 4px;
    background-color: red;
    top: 14px;
    -webkit-transform: rotate(45deg) skew(30deg,30deg);
    -moz-transform: rotate(45deg) skew(30deg,30deg);
    transform: rotate(45deg) skew(30deg,30deg);
}
li:before{
    left:-13px;
}
li:after{
    right:-13px;
}
li:nth-child(2):before{
    box-shadow: 0px 0 0 black,-4px 4px 0 black;
}
演示3:


看我的照片,它不完全是三角形。重新阅读我的问题。@BrijeshGajjar facepalm:Use-ms-transform和-o-transform-tooThis很棒+1但我们有相同的解决方案:opera现在是webkit,所以我们不再需要它,只要你想让它在老opera上工作,但它的角落太尖锐了。如何将其修改为@Mr.Alien的示例?请看图片示例:您的示例的箭头长度比图片上的更长。这个怎么样?
menu{
   position:relative;
   width:320px;
   height:40px;
}

li{
    float:left;
    width:50%;
    background-color:red;
    list-style:none;
    position:relative;
    height:54px;
    text-align:center;
    line-height:50px;
    color:white;
}

li:before,li:after{
    position: absolute;
    content: "";
    height: 32px;
    width: 32px;
    border-radius: 4px;
    background-color: red;
    top: 11px;
    -webkit-transform: rotate(45deg) skew(16deg,16deg);
    -moz-transform: rotate(45deg) skew(16deg,16deg);
    transform: rotate(45deg) skew(16deg,16deg);
}
li:before{
    left:-15px;
}
li:after{
    right:-15px;
}
li:nth-child(2):before{
    box-shadow: 0px 0 0 black,-4px 4px 0 black;
}
menu{
   position:relative;
   width:320px;
   height:40px;
}

li{
    float:left;
    width:50%;
    background-color:red;
    list-style:none;
    position:relative;
    height:54px;
    text-align:center;
    line-height:50px;
    color:white;
}

li:before,li:after{
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    border-radius: 4px;
    background-color: red;
    top: 14px;
    -webkit-transform: rotate(45deg) skew(30deg,30deg);
    -moz-transform: rotate(45deg) skew(30deg,30deg);
    transform: rotate(45deg) skew(30deg,30deg);
}
li:before{
    left:-13px;
}
li:after{
    right:-13px;
}
li:nth-child(2):before{
    box-shadow: 0px 0 0 black,-4px 4px 0 black;
}
menu{
   position:relative;
   width:320px;
   height:40px;
}

li{
    float:left;
    width:50%;
    background-color:red;
    list-style:none;
    position:relative;
    height:54px;
    text-align:center;
    line-height:50px;
    color:white;
}

li:before,li:after{
    position:absolute;
    content:"";
    height:40px;
    width:40px;
    border-radius:4px;
    background-color:red;
    top: 7px;
    -webkit-transform:rotate(45deg);
    -moz-transform:rotate(45deg);
    transform:rotate(45deg);
}
li:before{
    left:-20px;
}
li:after{
    right:-20px;
}
li:nth-child(2):before{
    box-shadow: 0px 0 0 black,-4px 4px 0 black;
}