HTML表格作为背景?

问题描述 投票:0回答:2

我使用html表制作了一些蜂窝自动机动画,并希望将这些动画作为网页的背景。是否可以将表格设为页面的背景?

html css background-image
2个回答
0
投票

虽然您当然可以在表上堆叠元素,但是不能以与背景图像相同的方式使用表。如果您提供一个示例,说明您现在拥有的东西以及您想要实现的目标。


0
投票

是的,绝对有可能。您想要做的就是用表格填充页面,方法是将其位置设置为绝对位置,将其强制插入左上角,并将宽度/高度值设置为100%:

#your-table {
    position: absolute;

    /* Force table into the top right corner */
    top: 0px;
    left: 0px;

    /* Expand table out into the rest of the window */
    width: 100%;
    height: 100%;
}

如果将pointer-events设置为“无”,则大多数浏览器将在用户将鼠标悬停在内容上时阻止更改光标。还有pointer-events,可用于user-select。因此,我建议在您的背景表中添加以下CSS规则,使其表现得更像背景:

user-select

祝您在项目中万事如意!

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.