帧的高度(以像素为单位)

发布于 2024-11-06 05:33:32 字数 1257 浏览 1 评论 0原文

我有 70 像素高的图像。我想精确地创建一个框架,以便我可以用该图像平铺其背景,而不会导致出现滚动条。

预期结果:

-------
|this has 70 pixels
--------
| the rest

我的 html 看起来像这样:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
    "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head><title></title></head>
<frameset rows="70,*">
    <frame noresize src="a.htm" >
    <frame noresize src="b.htm" >
</frameset>
</html>

a.htm 看起来像这样:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd"
<html><head><title></title></head>
<body style="background-image:url(70px_img.gif);background-repeat:repeat;" >
    <img src="another_70_px_img.png" style="float:left;" />
</body>
</html>

现在,第一个帧的内部显然超过 70 像素,从而出现滚动条。它还会弄乱内部的其他图像,因为它有一个很小的空白空间并且底部被裁剪。是否可以以具有精确高度的方式制作内部框架 - 我想知道是否需要在某处设置一些边框。

我知道 scrolling="no"。但这并不能阻止内部画面看起来不正常。我可以通过提供内部图片 height:50px 但不是 height:XX% 来“解决”裁剪问题,但这似乎不对。

我也知道框架是邪恶的,并计划稍后将其重新调整为

。过渡会顺利还是我必须重新调整一切?

I have 70 pixel high image. I want to create a frame precisely in such a way that I can tile its background with this image without causing a scrollbar to appear.

Intended result:

-------
|this has 70 pixels
--------
| the rest

my html looks something like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
    "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head><title></title></head>
<frameset rows="70,*">
    <frame noresize src="a.htm" >
    <frame noresize src="b.htm" >
</frameset>
</html>

a.htm looks something like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd"
<html><head><title></title></head>
<body style="background-image:url(70px_img.gif);background-repeat:repeat;" >
    <img src="another_70_px_img.png" style="float:left;" />
</body>
</html>

Right now, the inside of the first freame apparently gets more than 70 pixels, making a scrollbar appear. It also messes up the other image inside, since it gets a tiny empty space and the bottom is cropped. Is it possible to make the inner frame in such a way that is has the precise height - I'm wondering if there is some border I have to set somewhere.

I know about scrolling="no". But this doesn't stop the inner picture looking out of whack. I can "solve" the croping problem by giving the inner picture height:50px but not height:XX% but this doesn't seem right.

I also know frames are evil, and plan to repurpose this into a <div> later. Will transition be smooth or will I have to realign things all over again?

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

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

发布评论

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

评论(2

罪歌 2024-11-13 05:33:32

您需要重置框架内 html 和 body 的边距和填充:

<style type="text/css">
    html, body { margin:0; padding: 0}
</style>

这可能会帮助您开始,但根据您想要的内容,可能需要更多内容。可能还需要 scrolling=no

是的,框架已被弃用。很可能您不应该使用它们 - 但只有您自己知道!

You need to reset the margins and padding of html and body inside the frames:

<style type="text/css">
    html, body { margin:0; padding: 0}
</style>

This may get you started, but depending on what you want more may be needed. scrolling=no is probably also needed.

Yes, frames are deprecated. Odds are you shouldn't be using them - but only you can know!

蓦然回首 2024-11-13 05:33:32

如果内容没有超出边缘,请使用 overflow:hidden; 来防止滚动条。

<body style="background-image:url(70px_img.gif);background-repeat:repeat;overflow:hidden;" >

Use overflow:hidden; to prevent the scrollbars if you don't have content going over the edges.

<body style="background-image:url(70px_img.gif);background-repeat:repeat;overflow:hidden;" >
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文