我试图为移动浏览器制作一个特殊形状的标题。
我在我的电脑上使用 :before 和 :after 得到了我想要的三角形形状。虽然它在 PC 浏览器中看起来很棒......到目前为止,只有我的三星 Galaxy s2 和 s4 上的 chrome 浏览器给出了预期的效果。甚至三星的标准浏览器也失败了。
我还在 iphone s4 上对其进行了测试,但在 safari 和 chrome 中都没有成功。
在我找到的所有支持这些伪选择器的页面上,他们都声明每个浏览器都支持,但我的测试表明并非如此。
我的问题是,没有支持还是我的代码有误?
这是一个简单页面的链接,其中包含我设置的代码。 http://foodlogg.net76.net/pseudo.html
*{
margin: 0px;
padding: 0px;
}
.top {
background-color:#e50000;
height:20px;
width: 93vw;
text-align: left;
padding: 5px 0px;
}
.top:before {
content: '';
width: 0;
height: 0;
border-bottom: 20px solid transparent;
border-left: 93vw solid #e50000;
position: absolute;
left: 0px;
top: 30px;
}
.top:after{
content: '';
width: 0;
height: 0;
border-top: 0px solid transparent;
border-bottom: 30px solid transparent;
border-left: 7vw solid #e50000;
position: absolute;
right: 0px;
top: 0px;
}
希望你们能帮助我解决这个问题。