屏幕未最大化时垂直图像边框会更改对齐方式
我有一些非常简单的 HTML 代码,其中有一些表格来组织各种文本或图像项目。除了我需要在屏幕的左侧和右侧放置垂直边框之外,一切正常。我可以使用拉伸的 2x2 像素图像来完成此操作。当用户最大化屏幕时,一切看起来都很棒。但是,当用户点击“向下恢复”时,边框保持在原位,但表格会被向下推,以便它们从边框结束的位置下方开始,即屏幕外。换句话说,边框和表格之间的关系对齐完全搞砸了。有谁知道如何使这种对齐方式在恢复时保持一致?我几乎是html和asp的新手,所以慢慢说。如果有更好的方法来实现这一点,我洗耳恭听。谢谢。
这是代码的相关部分:
<form id="form1" runat="server">
<asp:Image ID="LeftBorder" src="../Images/Border_Blue.jpg" runat="server"
WIDTH="15" HEIGHT="1000" BORDER="0" alt="Image Missing" align="left"/>
<asp:Image ID="RightBorder" src="../Images/Border_Blue.jpg" runat="server"
WIDTH="15" HEIGHT="1000" BORDER="0" alt="Image Missing" align="right" />
<table id="BannerTable" style="height: 100px">
<tr>
<td width="934px">
<img src="../Images/Header.jpg"
alt="Image Missing" id="ImgBanner" align="left"/></td>
</tr>
</table>
I have some pretty straightforward HTML code with a few tables to organize various items of text or images. All works fine except that I need to place a vertical border on both the left and right sides of the screen. I am able to do this with a 2x2 pixel image that I stretch out. When the user has their screen maximized, everything looks great. But when the user hits "Restore Down", then the borders stay in place, but the tables get shoved down so that they start below where the borders end, which is off screen. in other words, the relational alignment between the borders and the tables gets all screwed up. Does anybody know how to make this alignment stay consistent on a restore down? I'm pretty much a newbie with html and asp, so speak slowly. If there is a better method to accomplish this, I'm all ears. Thanks.
Here is the relevant section of code:
<form id="form1" runat="server">
<asp:Image ID="LeftBorder" src="../Images/Border_Blue.jpg" runat="server"
WIDTH="15" HEIGHT="1000" BORDER="0" alt="Image Missing" align="left"/>
<asp:Image ID="RightBorder" src="../Images/Border_Blue.jpg" runat="server"
WIDTH="15" HEIGHT="1000" BORDER="0" alt="Image Missing" align="right" />
<table id="BannerTable" style="height: 100px">
<tr>
<td width="934px">
<img src="../Images/Header.jpg"
alt="Image Missing" id="ImgBanner" align="left"/></td>
</tr>
</table>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有一种更好的方法来完成您正在做的事情。
首先——你真的不应该使用表格。
话虽如此,您需要使用 div。
一个可以容纳所有东西的容器。
其中, a 代表左边框和右边框。使用CSS设置背景图片。重复-y就可以了。
您的桌子也需要进入 a 。
如果您遇到主容器未假设其子容器高度的问题,请查看 clearfix
There is a much better way to do what you're doing.
First of all --- you really should not use tables at all.
With that being said, you need to use divs.
A container to hold everything.
Inside that, a for the left and right border. Use CSS to set the background image. repeat-y on it.
Your table will need to go into a too.
If you run into problems of your main container not assuming the height of it's children, look into clearfix