简体   繁体   中英

Apply padding to display: table-cell element

I'm trying to apply padding to the left side of an element with display:table-cell. I am using a Webkit browser, and this will only ever have to work in a Webkit browser (yay!).

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

Here is my HTML (I've embedded css inline so that it's easier to read here):

<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;
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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