background square with one side at an angle [duplicate]

自闭症网瘾萝莉.ら 提交于 2020-01-14 14:59:28

问题


I want to be able to create a transparent background using only CSS but with an angle on one end. I've found various ways of trying to do it, but can't quite get it. I don't really want to use any scripting, just CSS.

Background image would need to look like this:


回答1:


You could do it using borders: http://jsfiddle.net/wNhjb/

#shape {
   height: 0; 
   width: 80px;
   border-top: 80px solid blue;
   border-left: 40px solid transparent;
}



来源:https://stackoverflow.com/questions/12699210/background-square-with-one-side-at-an-angle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!