本文介绍了为什么我的输入不适合div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我写了这个html和css代码:
I wrote this html and css codes:
HTML
<body>
<div id="container">
<div id="containerHeader">
<h1>Seek & enjoy</h1>
<h3>Your movie seeker</h3>
<div id="containerForm">
<form class="form-wrapper cf">
<div id="inputplusbuttons">
<input type="text" placeholder="Find your movie" required>
<div id="containerButtons">
<button id="seek" type="submit">Seek</button>
<button id="reset" type="submit">Reset</button>
</div>
</div>
</form>
</div>
</div>
<div id="results">
<p>
</p>
<div id="movieList">
</div>
<div id="movieDetails">
</div>
</div>
</div>
</body>
我正在尝试将输入适合div,但是我失败了,也不知道为什么(CSS代码在JSFiddFiddle上).我达到了这两个选择
I'm trying to fit an input into a div but I'm failing and don't know why (CSS code is on JSFiddFiddle). I reached these two options
http://jsfiddle.net/rmkc55zc/3/
在选项1中,输入宽度为100%,但输入长度大于div.在选项2中,我添加了 overflow:hidden
,但是随后输入被切掉,我不喜欢这样.
In option 1 input width is 100% but then input is longer than div.In option 2 I added overflow: hidden
but then input is cut and I don't like that.
有人知道我可以尝试解决的其他问题吗?
Does anybody knows something else I can try to fix it?
谢谢
推荐答案
添加 box-sizing:border-box;
属性设置为您的 input
样式.结果.
这篇关于为什么我的输入不适合div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!