简体   繁体   English

尝试在 HTML/CSS 中分隔复选框网格

[英]Trying to space grid of checkboxes in HTML/CSS

I want two lines of equally spaced checkboxes.我想要两行等距的复选框。 (seven per row first line with captions MON-SUN second row no caption) (每行 7 个第一行带字幕 MON-SUN 第二行无字幕)

I have a span around each of the checkboxes.我在每个复选框周围都有一个跨度。 If I set the Style="display: inline-block; width: 30px" it does what I expect, but when I create a rule in my stylesheet:如果我设置Style="display: inline-block; width: 30px"它会达到我的预期,但是当我在样式表中创建规则时:

.ckwidth {
  display: inline-block;
  width: 30px;
}

and then set the class="ckwidth" on the spans it seems to ignore the rule.然后在似乎忽略规则的跨度上设置 class="ckwidth" 。 What am I doing wrong?我究竟做错了什么?

Try out this, might help.试试这个,可能会有所帮助。 if this don't work then share your code.如果这不起作用,请分享您的代码。

.dis-flex {
    display: flex !important;
//or
display: inline-flex; 
 .ckwidth {
   margin: auto;
   width: 30px;
  }
}
-----------or----------------
.row {
   margin: auto;
 .ckwidth {
 display: flex !important;
   width: 30px;
  }
}

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

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