简体   繁体   English

应用填充以显示:table-cell元素

[英]Apply padding to display: table-cell element

I'm trying to apply padding to the left side of an element with display:table-cell. 我正在尝试使用display:table-cell将填充应用于元素的左侧。 I am using a Webkit browser, and this will only ever have to work in a Webkit browser (yay!). 我正在使用Webkit浏览器,这只需要在Webkit浏览器中工作(耶!)。

It displays in the proper arrangement, but as if there is no padding at all. 它以正确的排列显示,但好像根本没有填充。

Any pointers? 有什么指针吗? I'm a bit of a newb when it comes to display:table 在显示方面,我有点新手display:table

Here is my HTML (I've embedded css inline so that it's easier to read here): 这是我的HTML(我嵌入了css内联,因此在这里更容易阅读):

<div class="setting-group" style="display:table">
   <div class="title">Title</div>
   <div class="field" style="display:table-row">
      <span class="label" style="display:table-cell">Label</span>
      <select class="value" style="display:table-cell; padding-left: 20px" id="id">
         <option value="Opt 1">Option 1</option>
         ...
      </select>
    </div>
</div>

将您的选择包裹在一个范围内:

<span class="select" style="display:table-cell; padding-left:20px"><select class="value"  id="id"></span>

您还可以使用酒店......

border-spacing:10px;

Old school style, maybe? 老派风格,也许吧?

    .setting-group {
        padding-left:50px;
    }

    .setting-group .field .label {
        padding-right:20px;
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM