当前位置: 代码迷 >> HTML/CSS >> 怎么保证在Jsp 或Html 里table或div不因插入form而改变大小
  详细解决方案

怎么保证在Jsp 或Html 里table或div不因插入form而改变大小

热度:105   发布时间:2012-09-08 10:48:07.0
如何保证在Jsp 或Html 里table或div不因插入form而改变大小

如何保证table或div不因插入form而改变大小

一.问题描述:jsp /html 中,在table或div插入form后,表格或div变大了,影响了原来的布局

二.解放方法:

?????????????????此时设置table <td>或div的height, width是不起作用的,如下方法可以解决

??????方法一:最简单,在td中设置:overflow: hidden,?这样即使超出的部分也不会显示。

?????????????????????????<td height="25px"?style="overflow: hidden">

?????????????????或????<div??? style=" overflow:hidden?;100px; height:25px; float: left;"? >

???????????????????????div的样式加个overflow:hidden;,这样即便div中内容超了,也不会让div变大。

???????方法二:直接对form 设置其padding和margin属性,或在CSS或直接设置

?????????????????css:????????form{???padding: 0px;? margin: 0px;?}

????????????????直接设置;

???????????????<html:form action="/adminDeleteNews.do" method="post"?style="padding: 0px;margin: 0px;"?>

三.实践证明,这样做达到目的了。

  相关解决方案