无法在搜索框上获得保证金?

时间:2015-09-15 01:38:11

标签: javascript jquery html css

唯一有效的保证金属性是我的搜索框上的保留边。当我尝试添加margin-bottom时,搜索框不会移动。然后我尝试将显示更改为" block"但随后搜索框一直显示在我的屏幕左侧,并一直卡住。

有没有释放保证金,以便我可以在屏幕周围360度点移动我的搜索框?

以下是留在边距左侧的代码:

<input class="search" type="text" name="q" id="q" size="40" maxlength="50" style=  "display:block; position:relative;margin-left:-15%";>

这里是代码的小提琴:https://jsfiddle.net/4d4c2zdn/1/

1 个答案:

答案 0 :(得分:0)

您是否知道您的保证金给出了负值?保证金底部只会在布局中压低它下面的东西。您是否尝试移动搜索框?

使用position:relative;相对定位元素时,您也可以使用left:15%;right: -15%;等基本定位。这应该可以释放你的保证金。

I made a pen to better explain the situation.

相关问题