如何在HTML中创建像下面的UI

发布于 2025-02-03 01:36:27 字数 362 浏览 3 评论 0原文

.leftside {
padding: 16px;
background-color: #0E1E2B;
border-bottom-left-radius: 50%;

}`

我为网站页面设计了一个设计,我想使用HTML和CSS在标题中添加背景。在相同的背景中,我还添加了右侧,在这里我添加了我尝试过的CSS代码。

add background like this

.leftside {
padding: 16px;
background-color: #0E1E2B;
border-bottom-left-radius: 50%;

}`

I made a design for a website page and I want to add the background above in the header using HTML and CSS. in this same background I also added it right-side, here I'm adding the CSS code that I tried. I can not understand how to create a background like this!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

穿越时光隧道 2025-02-10 01:36:27

使用剪辑路径。该站点产生了一些数字。网站链接: https://bennettfeely.com/clippy/

Use clip-path. This site generate some figures. Site link: https://bennettfeely.com/clippy/

惜醉颜 2025-02-10 01:36:27

您也可以使用伪元素和border css属性来做到这一点。

此处如何工作背后的理论示例: css triangles如何工作

strong> codepen链接: https://codepen.io/thechewy/thechewy/thechewy/pen/pen/pen/pen/pen/pen/eyvmlgm

.leftside {
  width: 18rem;
  height: 10rem;
  background: red;
  position: relative;
}

/** triangle **/

.leftside:after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  bottom: 0;
  border-bottom: 10rem solid white;
  border-right: 100px solid transparent;
}
<div class="leftside"></div>

You can also do this by using pseudo elements and the border CSS property.

Example of the theory behind how this works here: How CSS triangles work

Codepen link: https://codepen.io/thechewy/pen/eYVMLGM

.leftside {
  width: 18rem;
  height: 10rem;
  background: red;
  position: relative;
}

/** triangle **/

.leftside:after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  bottom: 0;
  border-bottom: 10rem solid white;
  border-right: 100px solid transparent;
}
<div class="leftside"></div>

失去的东西太少 2025-02-10 01:36:27

这是您可能尝试或开始的方法:

#shape {
  width: 200px;
  border-top: 120px solid #ec3504;
  border-left: 60px solid transparent;
}
<div id="shape"></div>

替代选项是使用JavaScript库,甚至在HTML 5画布中使用。

Here's what you may try or start with:

#shape {
  width: 200px;
  border-top: 120px solid #ec3504;
  border-left: 60px solid transparent;
}
<div id="shape"></div>

Alternative options would be to use javascript library or even do in Html 5 canvas.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文