我正在面对问题,同时对齐div内的元素。对齐问题内部div
我想是这样的
|-----------------------------------------------|
|<P> | <input type = text> | imagebutton here |
|here | here | |
|-----------------------------------------------|
但我越来越像
|-----------------------------------------------|
|<P> | |
|here | |
| <input type = text> | |
| here | |
| imagebutton here |
|-----------------------------------------------|
因此,有一些问题,让下一个元素在div
要显示的当前元素,即若跌破我可以将<input>
与<p>
水平对齐,我认为这会给出解决方案。
下面是我的尝试:
CSS部分
.imagewrapper{
display: table-cell;
background-color:yellow;
margin-left: 70%;
width: 25%;
margin-bottom: 10%;
height: 35%;
}
.textwrapper{
display: table-cell;
background-color:blue;
margin-left: 30%;
width: 40%;
margin-bottom: 10%;
height: 35%;
}
.msg_wrapper{
display: table-cell;
background-color:lime;
margin-left:5%;
width: 25%;
margin-bottom: 10%;
}
HTML侧
<div id="searchClass">
<p class="msg_wrapper"><b>Class</b></p>
<input id="txt_class" style="background-color: Aqua; class = textwrapper >
<input type="image" id="searchclassimg" class="imagewrapper" src="./resource/search-button.png">
</div>
浮动杀死显示,你可以删除他们,他们变得无用:) –