简体   繁体   English

如何防止输入元素在父div内移位?

[英]How can I prevent shift of the input element inside parent div?

I have div that contains three elements. 我的div包含三个元素。

Here is the div: 这是div:

<div id="toolbarArea" class="toolbarArea" data-Owner="geomind" data-Date="11/2016"> 
                        <img id="toolbarTitle" width="15px" height="15px" src="../stdicons/threePoints.png">
                    <iframe id="frTools" style="width:400px;height:25px;overflow: hidden;" name="tbFrame" src="/data/mapview/toolbar.aspx?LOCALE=en" frameBorder="0"></iframe>

  <input type="text" id="txtSearch" placeholder="Sample Input"/>

</div>

The input text that inside div is shifted.Here how it looks: div内的输入文本已移位。其外观如下:

在此处输入图片说明

Here is jsfiddle . 这是jsfiddle

How can I prevent shift down of the input element and make it fit parent element? 如何防止输入元素下移并使其适合父元素?

You can just add vertical-align: top; 您可以只添加vertical-align: top; to the input field: 到输入字段:

#txtSearch {
  vertical-align: top;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM