垂直 CSS 进度条

发布于 2024-12-08 23:40:16 字数 625 浏览 2 评论 0原文

我正在致力于创建一个仅使用 HTML 和 CSS 自下而上的进度表。我面临的问题是叠加的图像没有排列在它所属的位置。有人可以帮我吗?

编辑

这是代码:

<h2>Fall Fest Candy Collection</h2>
<p>The Fall Fest candy collection has begun!  Follow along with the progress bar as we attempt to reach our goal of one million pieces of candy!</p>
<p>&nbsp;</p>
<div id="progress-bar">
<div id="progress-level" style="height: 79%; bottom: 0px; text-align: center;"></div>
</div>
<p style="margin-bottom: 15px; text-align: center;">79% collected</p>
<p> </p>

I am working on creating a progress meter that comes from the bottom up using only HTML and CSS. The problem I am facing is that the overlayed image doesn't line up where it belongs. Could someone please help me out?

Edit

Here is the code:

<h2>Fall Fest Candy Collection</h2>
<p>The Fall Fest candy collection has begun!  Follow along with the progress bar as we attempt to reach our goal of one million pieces of candy!</p>
<p> </p>
<div id="progress-bar">
<div id="progress-level" style="height: 79%; bottom: 0px; text-align: center;"></div>
</div>
<p style="margin-bottom: 15px; text-align: center;">79% collected</p>
<p> </p>

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

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

发布评论

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

评论(3

失而复得 2024-12-15 23:40:16
  • #progress-bar上,设置position:relative
  • #progress-level 上,删除 margin-top: 133px 并添加 bottom: 0。然后,将高度更改为更高的数字,例如50%,以便您可以看到它的工作情况。

  • On #progress-bar, set position: relative.
  • On #progress-level, remove margin-top: 133px and add bottom: 0. Then, change the height to a higher number, say 50%, so that you can see it working.

骷髅 2024-12-15 23:40:16

我修复了:

<div id="progress-level" style="height: 7%; margin-top: 76px; text-align: center;"></div>

将上边距更改为 76px。
那是在 Chrome 的开发者工具中。

I fixed with:

<div id="progress-level" style="height: 7%; margin-top: 76px; text-align: center;"></div>

Changed the top margin to 76px.
That was in Chrome's developer tools.

冰葑 2024-12-15 23:40:16

我会尝试使用 position:relativebottom 属性来向上移动 #progress-level,但我现在无法尝试,我使用的是移动设备; -)。

I would try using position:relative and bottom properties to move the #progress-level up, but I can't try it out now, I am on a mobile device ;-) .

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