html - 3 列 css 显示不正确的问题

标签 html css

有点问题,我有一个 3 列显示文本和复选框,但是它在页面中正确居中,但框和文本居中

looky here

我希望内容在页面中居中,但希望文本和复选框正确垂直对齐。请帮忙,谢谢!

html

<div class="center">
{foreach key=num item=listtld from=$tldslist}
  <div class="column">
      <input type="checkbox" name="tlds[]" value="{$listtld}"{if in_array($listtld,$tlds)} checked{/if}>
      {$listtld}
      {if $num % 5 == 0}
      {/if}
  </div>
{/foreach}
</div>

CSS

  div.column {
    width: 30%;                     /* approximately 1/6 */
    display: inline-block;
    zoom: 1;                        /* ie-7 hack for inline block to work */
    *display: inline;               /* ie-7 hack for inline-block to work */
  /*  border: 1px solid red; */         /* temporary - to clearly show the box */
    -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
    -moz-box-sizing: border-box;    /* Firefox, other Gecko */
    box-sizing: border-box;         /* to prevent padding issues if you add padding */
    margin: 0;                      /* to ensure the right width */
    vertical-align: top;            /* to line them up evenly across the top */
}

最佳答案

试试这个:http://jsfiddle.net/techsin/6cs47/

这非常简单,您所要做的就是摆脱所有旧样式并使用 html5 的这一新列功能。

.con {
    border:1px solid;
    -webkit-column-count:3;
}

关于html - 3 列 css 显示不正确的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23749373/

相关文章:

html - 文字颜色不能做成白色

javascript - 对象标签覆盖 div 标签,如何防止这种情况发生?

css - 嵌套导航链接在 IE 9 中消失得太快

javascript - 如何使用 javascript 更改 HTML 中不匹配单词的颜色

php - 如果从数据库端检查的验证是正确的,如何在 PHP 中隐藏表单提交的分区?

javascript - 您如何在单击时删除一个类并将其添加到两个列表元素

asp.net - 如何在 html 菜单中使用箭头标记而不是元素符号

css - 如何使用 Bootstrap 在响应式 View 中拆分列?

javascript - addClass 悬停在多个元素上

html - 删除 html/css 中单词之间的额外空格