html - 如何在 CSS 中对齐元素

标签 html css datatables

我无法将元素对齐在一行中。我正在使用 display: inline-block 但由于某种原因它没有受到影响。我正在使用 DataTables。我希望按钮(图像)与显示页码的框对齐。

enter image description here

CSS

.dataTables_paginate input {
 width: 8%; 
 height: 8%; 
 padding-bottom: 0.2px;
 display: inline-block; 
 font: normal 11px Verdana, Arial, Helvetica, sans-serif;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
 box-sizing: border-box;
 display: inline-block;
 min-width: 1.5em;
 padding: 0.5em 1em;
 margin-left: 2px;
 text-align: center;
 text-decoration: none !important;
 cursor: pointer;
 *cursor: hand;
 color: #333 !important;
 border: 1px solid transparent;
border-radius: 2px;
}

我的 Jquery

var table = $('#esignTable').DataTable({"sDom": '<"top"flp>rt<"bottom"i><"clear">',
      pagingType: 'input',
      pageLength: 5,
      language: {
        "sEmptyTable": " ",
        oPaginate: {
            "sNext": '<img src="../images/integration/SlowRight.jpg">',
            "sPrevious": '<img src="../images/integration/SlowLeft.jpg">',
            "sFirst": '<img src="../images/integration/FastLeft.jpg">',
            "sLast": '<img src="../images/integration/FastRight.jpg">',
        }
      }   
    });

最佳答案

vertical-align:middle 添加到 .dataTables_wrapper .dataTables_paginate .paginate_button

或者使用 flexbox 进行分页

.dataTables_wrapper .dataTables_paginate {
  display:flex;
  flex-direction:row;
  align-items:center;
}

关于html - 如何在 CSS 中对齐元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44978807/

相关文章:

javascript - 如何让内联元素在空时占用空间?

html - 响应内容拉伸(stretch)

jquery - 我如何使用 jquery 一次添加子属性?

jQuery - 数据表 - ColumnFilter 不起作用

javascript - 如何将 dataTables 的 "aLengthMenu"值转换为 PHP 变量?

jquery - 设置数据表长度菜单的自定义位置

javascript - 如何获取 Paho 的最后 5 条消息?

javascript - Chrome 扩展用 newtab.html 覆盖 newtab,然后访问 cookie

jquery - 是否应该使用 > *、> * > * 等全局动画类来为 :change states? 提供快速动画

css - 删除两列 Bootstrap 之间的空间