[英]div height increases automatically
I've created a div. 我创建了一个div。 that contains another three div.
包含另外三个div
HTML: HTML:
<div id="a">
<div id="a1">
<img src="p.png" alt="an image" height="50" width="200">
</div>
<div id="a2">
<form method="post">
<input type="text" class="textbox"/>
</form>
</div>
<div id="a3"></div>
</div>
CSS: CSS:
#a
{
height:50px;
width:100%;
display: table;
position: fixed;
}
#a1
{
width: 200px;
height: 100%;
display: table-cell;
}
#a2
{
height: 100%;
background-color: #664499;
display: table-cell;
}
.textbox
{
height: 50px;
float: left;
margin: 0px;
border: 0px none;
}
#a3
{
width: 200px;
height: 100%;
background-color: #669999;
display: table-cell;
}
my question is when i put any tag into that like img
or input
the parent div 'a' increases its height by 3 automatically. 我的问题是,当我将任何标签放入
img
这样的标签或input
父div'a'时,它的高度会自动增加3。
and if i remove that tags it behaves normal. 如果我删除该标签,它的行为正常。 tried min-height option but didn't worked for me.
尝试了最小高度选项,但对我没有用。
What should i do in order that wrapper div 'a' doesn't change its height? 为了使包装div'a'不改变高度,我该怎么办?
try removing height: 50px;
尝试移除
height: 50px;
from .textbox
class may fix your problem. 从
.textbox
类可以解决您的问题。
Try this 尝试这个
<div id="Inner_Right_Layout">
<table>
<tr>
<td><div class="usr_img_div">
<img src="~/Images/username.png" />
</div></td>
<td><div class="usrnm_txtbx_div">
<input type="text" id="txtUserName" class="textprop" /></td>
</tr>
<tr>
<td><div class="usr_img_div">
<img src="~/Images/password.png" />
</div></td>
<td><div class="usrnm_txtbx_div">
<input type="password" id="txtPassword" class="textprop" /></td>
</tr>
<tr>
<td><div class="usr_img_div">
<img src="~/Images/password.png" />
</div></td>
<td><div class="usrnm_txtbx_div">
<input type="password" id="txtPassword" class="textprop" /></td>
</tr>
</table>
and css for this is 和CSS为此
#Inner_Right_Layout {
background-color: #43BDA4;
height: 100%;
width: 100%;
border: 0;
padding: 0;
margin: 0;
}
#control_main_div {
height: 50%;
width: 70%;
margin-left: 0%;
margin-top: 0%;
border:1px solid black;
}
.username_div {
height: 15%;
width: 100%;
margin: 0px;
border:;1px solid blue;
padding-bottom:5px;
}
.usr_img_div {
height: 10%;
width: 15%;
float: left;
border:;1px solid red;
}
.usrnm_txtbx_div {
width: 80%;
margin-left: 0%;
font-family: Ubuntu;
border:1px solid yellow;
margin-top:0%;
}
.textprop {
height: 80%;
width: 90%;
margin: 0;
padding: 0;
border: 0;
margin-left: 1px;
font-family: 'Ubuntu';
font-size: 16px;
font-weight: 100;
}
let me know ,if any changes needed 让我知道,是否需要任何更改
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.