ajax发布后CSS发生变化

标签 css

我有一个列表页面,每一行都是这样的。

<div class="column RightButtons">
<input type="button" class="btn Buttons" onclick="SetStudentPassword(2065)" value="Şifre Değiştir">
<input type="button" class="btn Buttons" onclick="OpenClassChangeDialog(2065)" value="Sınıf Değiştir">
<input type="button" class="btn Buttons" onclick="window.location.href = '/Parent/List?StudentId=2065'" value="Veliler">
<input type="button" class="btn Buttons" value="Düzenle" onclick="window.location.href = '/Student/Update?StudentId=2065'">
</div>

使用 ajax post 我过滤行并获取新行。我在 javascript 中创建了一个变量,其中包含这样的 html 字符串。

<div class="column RightButtons">
<input type="button" class="btn Buttons" onclick="SetStudentPassword(2065)" value="Şifre Değiştir">
<input type="button" class="btn Buttons" onclick="OpenClassChangeDialog(2065)" value="Sınıf Değiştir">
<input type="button" class="btn Buttons" onclick="window.location.href = '/Parent/List?StudentId=2065'" value="Veliler">
<input type="button" class="btn Buttons" value="Düzenle" onclick="window.location.href = '/Student/Update?StudentId=2065'">
</div>

所有属性都相同。所有的CSS都是一样的。但是第二个 html 按钮比前一个更近。请帮忙

最佳答案

您可能正在与行内 block 和空格作斗争。

你可以试试several things但我推荐的方法是,如果您的按钮必须保留内联 block ,则将字体大小调整为零。

.RightButtons {
    font-size: 0;
}
.RightButtons .btn {
    font-size: 14px;
}

或者,如果您的按钮要保持在同一行上,您可以尝试将它们向左浮动。

.RightButtons .btn {
    float: left;
    margin-right: 15px;
}
.RightButtons:after {
    content: ""
    display: table
    clear: both
}

关于ajax发布后CSS发生变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25832345/

相关文章:

HTML 标题属性

html - 如何在 li 元素之间设置相等的边距

javascript - 如何使用 jquery 在悬停/鼠标悬停时淡入 div?

javascript - 在悬停时选择 sibling

html - 将流体 div 向上移动一排 - 但在 Dreamweaver 中不是

css - 高度不在两列导航菜单的第一列中拉伸(stretch)

html - CSS 媒体查询没有响应

javascript - 单击菜单项之一时菜单下拉

javascript - jQuery Dim 或在悬停时更改其他列表项

CSS 转换导航问题