应用填充来显示:表格单元格元素

发布于 2024-10-01 15:21:29 字数 697 浏览 1 评论 0原文

我正在尝试使用 display:table-cell 将填充应用到元素的左侧。我正在使用 Webkit 浏览器,并且这只需要在 Webkit 浏览器中运行(耶!)。

它以正确的排列方式显示,但好像根本没有填充。

有什么指点吗?当谈到 display:table 时,我有点新手,

这是我的 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>

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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

滥情空心 2024-10-08 15:21:29

将您的选择包含在一个跨度中:

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

Wrap your select in a span:

<span class="select" style="display:table-cell; padding-left:20px"><select class="value"  id="id"></span>
油焖大侠 2024-10-08 15:21:29

您还可以使用该物业...

border-spacing:10px;

You can also use the property...

border-spacing:10px;
凉城已无爱 2024-10-08 15:21:29

老派风格,也许吧?

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

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

Old school style, maybe?

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

    .setting-group .field .label {
        padding-right:20px;
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文