HTML<正文>带背景图像

发布于 2024-11-18 22:21:07 字数 157 浏览 4 评论 0原文

假设我有一个标签,在 CSS 中,我将其定义为具有 1px 宽的背景图像,带有重复 x...此外,对于此主体,我没有定义或给出任何宽度。

还有一些其他内容也出现在页面上..

现在我的问题是这个背景图像给身体跨度的宽度是多少...比如它的边界框是什么以及它的宽度是多少?

Lets say I have a tag and in the CSS, I define it as having a bacground image of 1px wide, with repeat-x...Also for this body, I do not define or give any width..

There is some other content present on the page as well..

Now my question is what or how wide will this background image given to the body span...Like what will be it's bounding box and what will be it's width ?

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

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

发布评论

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

评论(2

⊕婉儿 2024-11-25 22:21:07

它将绑定到已根据 CSS 特异性规则在 CSS 中指定的元素(以及元素的大小)。对于 标记,它将继续浏览器窗口的宽度。

如果该元素由于某种原因从父元素继承了其宽度,则背景图像将采用该父元素指定的宽度减去填充和边距。

有关特异性规则的更多信息,请访问 Smashing Magazine

我希望这有帮助。

It will be bound to the element (and therein the size of the element) that has been specified in the CSS per the CSS rules of specificity. In the case of the <BODY> tag, it will continue for the width of the browser window.

If the element has inherited it's width from a parent element for some reason the background image will go for this parent elements specified width less padding and margins.

More info on the rules of specificity at Smashing Magazine

I hope this helps.

我的黑色迷你裙 2024-11-25 22:21:07

如果 body 标签不受任何 CSS 或脚本的约束,那么它的宽度将是窗口宽度或窗口内内容的最大宽度中的较大者(与 div 的规则类似)。因此,您的背景将重复全宽。不受约束的主体高度只会与其中内容一样高。

If the body tag is unconstrained by any CSS or scripting, then it's width will be the larger of the width of the window or the max width of the content within it (similar rules as a div). So, your background will repeat full width. An unconstrained body height will only be as tall as the content inside it.

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