开发者

Apply padding to display: table-cell element

开发者 https://www.devze.com 2023-01-24 20:54 出处:网络
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!).

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>


Wrap your select in a span:

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


You can also use the property...

border-spacing:10px;


Old school style, maybe?

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

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

精彩评论

暂无评论...
验证码 换一张
取 消