Vertical Image Border Changes Alignment when Screen is not maximized
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 screw开发者_如何学运维ed 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>
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.
<div class="container">
<div class="leftBorder"></div>
<div>
Your table
</div>
<div class="rightBorder"></div>
</div>
If you run into problems of your main container not assuming the height of it's children, look into clearfix
精彩评论