简体   繁体   中英

Css3: right trapezoid with border

I'm trying to create a transparent right trapezoid with color border using CSS 3 This is what I've gotten so far.

http://jsfiddle.net/bodyfarmer/bdhtn7kr/1/

Any help is appreciated

You have to place a right border on the containing object to get the correct look. Like this:

border-right: 20px solid red;

Here is the updated fiddle

I also changed skew to skewX. Per this link :

Note: The skew() function was present in early drafts. It has been removed but is still present in some implementations. Do not use it.

To achieve the same effect, use skewX() if you were using skew() with one parameter or matrix(1, tan(ay), tan(ax), 1, 0, 0) for the general way. Note that tan() isn't a CSS function and you have to precalculate it yourself.

在您的代码中,您缺少边框规则的一部分。

border: 20px solid red;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM