[英]Oblique div not properly transforming?
I have an oblique div created with transform: skewY(-10deg);我有一个用变换创建的斜 div:skewY(-10deg); But i can't center it on the top of the page with the instruction top:%.但是我不能使用指令 top:% 将它放在页面顶部的中心。
It is not working responsively.它没有响应工作。
How do I get this to work?我如何让这个工作?
With top:0 and left:0:顶部:0 和左侧:0:
With top:-135px:顶部:-135px:
Try changing the css of the element triangle-div
to the below.尝试将元素triangle-div
的 css 更改为以下内容。
#triangle-div{
width: 0;
height: 0;
border-top: 100px solid red;
border-right: 200px solid transparent;
position: fixed
}
Please provide as jsfiddle or an image of what you are trying to achieve - It is unclear what you want.请提供 jsfiddle 或您要实现的目标的图像 - 目前尚不清楚您想要什么。
However, to position the div centrally:但是,要将 div 集中放置:
div {
position: fixed;
top: 0;
left: 50%;
transform:translateX(-50%);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.