html - CSS Foundation 清除默认边距以加入对象

标签 html css margin zurb-foundation-5

我想将文本框和按钮连接在一起,没有任何空格 IN BETWEEN 它们在 Foundation-Zurb 框架中。我已经从所有内容中删除了 margin 。

screenshot of the described situation

<style>
    .margin-top{
    margin-top: .7em;
}

.margin-top div input[type="text"] {
    height:2em;
}

.button-height {
    width:5em;
    padding:.3em;
}
</style>
<body>

    <div class="row margin-top">

        <div class="small-7 columns">   
            <img src="http://placehold.it/220x67">
        </div>

        <div class="small-3 columns no-margin">
            <input type="text" class="input-small no-margin">
        </div>

        <div class="small-2 columns no-margin">
            <button class="button-height no-margin">search</button>
        </div>

    </div>  <!-- end-of-ROW1 -->


</body>
</html>

最佳答案

在基础中,每一列的左右都有填充。所以你看到的是创建该空间的列的左右填充的结果。您将不得不覆盖列填充。首先,围绕要从中删除填充的代码部分创建一个独特的包装器。这很重要,因此您不会从页面上的每一列中删除列填充。然后,选择该 div 包装器内的列类以从该部分删除列填充。

CSS:

.unique-div-name .columns {
    padding-left: 0;
    padding-right: 0;
}

HTML:

<div class="row margin-top unique-div-name">

    <div class="small-7 columns">
        <img src="http://placehold.it/220x67">
    </div>

    <div class="small-3 columns no-margin">
        <input type="text" class="input-small no-margin">
    </div>

    <div class="small-2 columns no-margin">
        <button class="button-height no-margin">search</button>
    </div>

</div>

关于html - CSS Foundation 清除默认边距以加入对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29350082/

相关文章:

html - 在显示表格单元格中使用边距

javascript - jquery更改php if语句上的元素

javascript - 为什么用鼠标滚轮滚动背景会闪烁?

html - CSS:将元素定位在区域之外而不更改滚动条

html - 调整浏览器大小时如何使元素保持在同一位置?

具有填充和边距以及 100% 宽度的 HTML CSS 框?

javascript - 单击转到 url 和内容类名更改

html - 100% 宽度表格中的省略号

javascript - 使用 Regex 删除某些 HTML 标签

javascript - 在 CSS 中设置时无法使用 JavaScript DOM 检测边距