需要图像来溢出 Internet Explorer 中的 Div

发布于 2024-12-29 20:59:58 字数 240 浏览 1 评论 0原文

我有一个名为 .header 的 div 类,高度为 30px。

.header div 中,我有一个图像我想要从中溢出。

该图像高 50 像素,在 Chrome 和 Firefox 中会溢出。

为什么它在 Internet Explorer 中不会溢出? .header div 只是扩展到 50px,因此不再溢出。

I have a div class I named .header with a height of 30px.

Within the .header div I have an image I want to overflow out of it.

The image is 50px tall and it overflows in Chrome and Firefox.

Why does it not overflow in Internet Explorer? The .header div just expands to the 50px so it no longer overflows.

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

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

发布评论

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

评论(2

北方。的韩爷 2025-01-05 20:59:58

如果您希望它在所有浏览器中工作,您可以为 div 提供背景图像

<div style="background: url(your_image.jpg); background-repeat: no-repeat;" >
</div>

,或者如果您希望内容溢出 div 尝试

<div style="overflow: visible;" >
</div>

if you want it to work in all browsers you could give the div a background image for example

<div style="background: url(your_image.jpg); background-repeat: no-repeat;" >
</div>

or if you want the content to overflow out of the div try

<div style="overflow: visible;" >
</div>
简美 2025-01-05 20:59:58

对于 IE,您需要将包含图像或图像本身的 div 设置为:

position:relative;

这应该可以正常工作并显示图像的溢出。

For IE you need to set the div containing the image or the image itself to:

position:relative;

That should work fine and display the overflow of the image.

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