您现在的位置是:首页 > 电脑 > 

是否可以使用css创建这样的背景?(is it possible to create a background like this using css? [duplicate])

2025-07-18 22:10:22
是否可以使用css创建这样的背景?(is it possible to create a background like this using css? [duplicate]) 这个问题在这里已有答案: 形状有倾斜的一面(响应) 2个答案 我有一个要求在网页上设置这个背景,我正在使用这个图像来做到这一点,但我相信应该有
是否可以使用css创建这样的背景?(is it possible to create a background like this using css? [duplicate])

这个问题在这里已有答案:

形状有倾斜的一面(响应) 2个答案

我有一个要求在网页上设置这个背景,我正在使用这个图像来做到这一点,但我相信应该有一种方法来使用CSS,我知道你可以使用css绘制对角线但不知道如何着使用css的其余部分。

提前致谢!

This question already has an answer here:

Shape with a slanted side (respive) answers

I have a requirement to set this background on a web page and I'm using this image to do that, but I believe there should a way to do this using CSS, I know you can draw diagonals using css but not sure how to color the rest of the box using css.

Thanks in advance!

最满意答案

是的,这是可能的。 随意更改课程以满足您的需求。

CSS:

body { position: relative; } .opti_wrapper { width: 500px; /* Change to suit your needs */ height: 80px; /* Change to suit your needs */ position: absolute; top: 0; right: 0; } .opti { width: 100%; height: 100%; box-shadow: 1px 0 rgba(0, 0, 0, 0.15); float: left; position: relative; overflow: hidden; } .opti:before { width: 100%; height: 100%; background: #8A0808; box-shadow: inset 0 1px rgba(255, 255, 255, 0.5), inset 1px 0 rgba(255, 255, 255, 1); content:''; position: absolute; top: 0; left: 0; transform-origin: top left; transform: skewX(45deg); /* Change to suit your needs */ }

HTML:

<div class="opti_wrapper"> <div class="opti"></div> </div>

这是一个Demo: jsFiddle DEMO

Thanks everyone, I see there are many different ways to achieve the same result, However as I needed to have this pattern as a background for my menu, I ended up using the bellow style:

.navbar { background: linear-gradient(45deg, white 25%, rgba(140, 25, 29, 1) 25%); background-size: 100% 100%; background-repeat: no-repeat; height: 90px; }

#感谢您对电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格的认可,转载请说明来源于"电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格

本文地址:http://www.dnpztj.cn/diannao/654070.html

相关标签:无
上传时间: 2023-07-28 12:51:56
留言与评论(共有 20 条评论)
本站网友 让我们记住
24分钟前 发表
100% 100%; background-repeat
本站网友 李连杰博客
24分钟前 发表
rgba(140
本站网友 麦考林
26分钟前 发表
Shape with a slanted side (respive) answers I have a requirement to set this background on a web page and I'm using this image to do that
本站网友 企业社会保险
25分钟前 发表
我知道你可以使用css绘制对角线但不知道如何着使用css的其余部分
本站网友 flicker
14分钟前 发表
Shape with a slanted side (respive) answers I have a requirement to set this background on a web page and I'm using this image to do that
本站网友 大咔秀
15分钟前 发表
CSS: body { position
本站网友 美汁源果粒橙有毒
13分钟前 发表
linear-gradient(45deg
本站网友 绍兴俞家
22分钟前 发表
100%; box-shadow
本站网友 人参果是热性还是凉性
8分钟前 发表
0
本站网友 广东科技学院官网
5分钟前 发表
0.5)
本站网友 虚假
10分钟前 发表
100%; height
本站网友 tanfu
1分钟前 发表
hidden; } .opti
本站网友 人工授精过程
0秒前 发表
我正在使用这个图像来做到这一点
本站网友 泣别简谱
25分钟前 发表
0; left
本站网友 股票投资风险
6分钟前 发表
I ended up using the bellow style
本站网友 努尔百克力
25分钟前 发表
0; } .opti { width
本站网友 孕妇营养食谱大全
20分钟前 发表
linear-gradient(45deg
本站网友 gongshangyinghang
17分钟前 发表
100%; height
本站网友 印度大停电
4分钟前 发表
25