小编kuk*_*kuz的帖子

如何使弹性物品收缩到最小的合适尺寸,但尺寸相同?

我正在尝试制作一排按钮,其中的按钮将具有相同的大小,但应尽可能小-因此每个按钮都与最大的按钮具有相同的大小。

我怎样才能做到这一点?

div {
  border: solid 1px black;
  margin: 5px;
  padding: 5px;
  background-color: #fff;
}
.container {
  display: flex;
  flex-flow: row nowrap;
  justify-content: flex-end;
}
.item {
  background-color: #eef;
  flex: 0 1 auto;
  white-space: nowrap;
}
Run Code Online (Sandbox Code Playgroud)
<div class="container">
  <div class="item">this one is quite long</div>
  <div class="item">short</div>
</div>
Run Code Online (Sandbox Code Playgroud)

html css css3 flexbox

7
推荐指数
1
解决办法
1521
查看次数

当鼠标悬停在firefox中的子元素上时

当使用此规则将鼠标悬停在firefox中.parent:hover > .child { /*style*/ }的子元素上时,子元素将被视为不是父元素的一部分,因此不会设置样式.就像在下面的代码片段中一样,如果你将鼠标悬停在按钮上,那么子元素会受到影响但是当div被悬停时它不会改变.

但是在徘徊在父母和孩子身上的铬会影响孩子.我觉得这对现在正在进行的工作很有用,那么我有没有办法在firefox中实现相同的效果?

button {
  position: relative;
}
button:hover > div {
  background-color: #67BDFF;
}
button:hover > div:before {
  content: "SMURF!";
  position: absolute;
  font-weight: bolder;
  font-size: 20px;
  top: 10px;
}
button > div {
  position: absolute;
  top: 18px;
  left: 0;
  padding: 40px;
}
Run Code Online (Sandbox Code Playgroud)
<button>
  hover over me and my child will turn smurf
  <div>
    i'll remain smurf if you over over me cus am part of my parent, but not in firefox
  </div>
</button>
Run Code Online (Sandbox Code Playgroud)

html css firefox google-chrome

7
推荐指数
1
解决办法
617
查看次数

选择单选按钮时更改单选按钮标签的颜色?

当选择单选按钮时,有没有办法为单选按钮的颜色变化设置标签?

我希望标签与hover状态上的绿色相同,但我似乎无法弄清楚如何实现这一目标?

label.btn span {
  font-size: 16px;
}
i.fa {
  font-size: 24px;
}
i.fa.fa-dot-circle-o {
  font-size: 24px;
}
label input[type="radio"] {
  color: #c8c8c8;
  display: inline;
}
label input[type="radio"] ~ i.fa.fa-dot-circle-o {
  display: none;
}
label input[type="radio"]:checked ~ i.fa.fa-circle-o {
  display: none;
}
label input[type="radio"]:checked ~ i.fa.fa-dot-circle-o {
  color: #78a025;
  display: inline;
  font-size: 24px;
}
label:hover input[type="radio"] ~ i.fa {
  color: #78A025;
}
label input[type="checkbox"] ~ i.fa.fa-square-o {
  color: #c8c8c8;
  display: inline;
}
label input[type="checkbox"] ~ i.fa.fa-check-square-o {
  display: …
Run Code Online (Sandbox Code Playgroud)

html css label css-selectors radio-button

7
推荐指数
1
解决办法
6510
查看次数

如何在我的css代码中增加计数器?

在我的html代码中,我定义了以下列表:

<p class="list">first.</p>
<p class="list">second.</p>
Run Code Online (Sandbox Code Playgroud)

现在,css我有:

.list {
  display: table;
}
.list:before {
  display: table-cell;
  counter-increment: counter;
  content: counter(counter) '.';
  padding-right: 5px;
}
Run Code Online (Sandbox Code Playgroud)

并且页面上的结果是:

1. first
1. second
Run Code Online (Sandbox Code Playgroud)

如何将第二个数字增加到2的值?

html css list css-tables css-counter

7
推荐指数
1
解决办法
1856
查看次数

如何在表格顶部设置表格标题?

我试图在表格结构中设置日历,但我不知道如何在表格顶部设置标题。

\n\n

我也无法更改表结构。我希望它看起来像下面这样:在此输入图像描述

\n\n

\r\n
\r\n
.calendar_wrap table {\r\n    width: 100%;\r\n}\r\n.calendar_wrap #wp-calendar thead th {\r\n    font-weight: 500;\r\n    color: #45515a;\r\n    font-size: 20px;\r\n    line-height: 28px;\r\n}\r\n.calendar_wrap #wp-calendar tbody td {\r\n    font-weight: 400;\r\n    font-size: 24px;\r\n    line-height: 36px;\r\n    color: #5b666f;\r\n}\r\n.calendar_wrap #wp-calendar tfoot td a {\r\n    color: #3d9596;\r\n    font-weight: 500;\r\n    margin-top: 10px;\r\n    display: inline-block;\r\n    font-size: 22px;\r\n    line-height: 32px;\r\n}\r\n.calendar_wrap #wp-calendar tbody td a {\r\n    color: #EF9950;\r\n}\r\n.calender-box {\r\n    padding: 15px;\r\n    border: 1px solid #d4d9dd;\r\n    border-radius: 8px;\r\n}\r\ncaption {\r\n    font-size: 30px;\r\n    line-height: 36px;\r\n    color: #007ab0;\r\n}
Run Code Online (Sandbox Code Playgroud)\r\n
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" …
Run Code Online (Sandbox Code Playgroud)

html css calendar html-table css-tables

7
推荐指数
1
解决办法
1万
查看次数

Chrome通过自定义样式为文本输入添加了意外的填充

简而言之,这个小提琴在Firefox上运行正常,但在Chrome上却没有.

输入与选择具有相同的样式,应该是相同的高度,但它不在Chrome上,我该如何解决这个问题?

经过进一步检查,它似乎与溢出属性有关,不知道为什么

@import url(https://fonts.googleapis.com/css?family=Open+Sans);
.my-custom-forms {
    font-family: 'Open Sans',serif;
}
select.my-custom-forms, input.my-custom-forms{
    border-top: none;
    border-left: none;
    border-right: none;
    border-radius: 0;
    border-bottom: 2px solid lightblue;
    padding: .25rem .1rem .25rem .1rem;
    overflow: auto;
    width: 100%;
    background-color: transparent;
    transition: border .5s ease;
}
Run Code Online (Sandbox Code Playgroud)
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container m-3">
  <div class="row">
    <div class="col-3">
      <select class="my-custom-forms">
        <option>Option</option>
      </select>
    </div>
    <div class="col-3">
      <select class="my-custom-forms">
        <option>Option</option>
      </select>
    </div>
    <div class="col-6">
      <input placeholder="text" class="my-custom-forms">
    </div>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

我使用Bootstrap作为准系统,但不确定它是否与问题有关.

html css css3 twitter-bootstrap bootstrap-4

7
推荐指数
1
解决办法
240
查看次数

我如何在左边对齐2个第一个元素,在右边对齐最后一个元素

我认为我的代码井井有条,但是我不知道为什么我无法以这种方式组织元素:

|**   *|
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

|**   *|
Run Code Online (Sandbox Code Playgroud)
.container {
  border: 1px solid red;
  display: flex;
  justify-content: flex-start;
  width: 100%;
  height: 200px;
  flex-direction: row;
}

.container div {
  border: 1px solid blue;
  height: 100px;
  width: 100px;
}

.right {
  display: flex;
  align-self: flex-end;
}
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?这是我的实时代码:https : //jsfiddle.net/uxpkh9nL/

html css css3 centering flexbox

7
推荐指数
1
解决办法
81
查看次数

使CSS网格适合最小空间

我有这样的事情:

.row {
  width: 300px;
  border: 1px solid black;
  display: flex;
}

.otherstuff {
  flex-grow: 1;
}

.grid {
  display: grid;
  grid-auto-flow: column;
  gap: 10px 10px;
}

.cell {
  border: 1px solid blue;
}
Run Code Online (Sandbox Code Playgroud)
<div class='row'>
  <div class='stuff'>Stuff</div>
  <div class='otherstuff'>
    <div class='grid'>
      <div class='cell'>Cell 1</div>
      <div class='cell'>Cell 2</div>
    </div>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

我希望网格仅占用所需的最小空间,而不要扩展。我已经阅读了该线程,并看到使用grid-template-columnsauto值是可行的,但是有一种方法可以在不事先知道子代数的情况下进行吗?

谢谢。

html css css3 css-grid

7
推荐指数
2
解决办法
123
查看次数

从底部有没有任何css浮动元素的方法?

鉴于以下HTML:

<div>
  lorem ipsum...
  <img style="float:left;margin-top:-100px" />
</div>
Run Code Online (Sandbox Code Playgroud)

我希望得到这样的东西:

在此输入图像描述

但实际上我最终获得的是:

在此输入图像描述

.Block {
  width: 300px;
  margin: auto;
}

.Image {
  width: 150px;
  float: left;
  margin-top: -100px;
}
Run Code Online (Sandbox Code Playgroud)
<div class="Block">
  Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Aenean lacinia bibendum nulla sed consectetur.
  <br><br>
  Nullam id dolor id nibh ultricies …
Run Code Online (Sandbox Code Playgroud)

html css css-float

6
推荐指数
1
解决办法
72
查看次数

如何让边框重叠?

我试图让头部的边框顶部有一种颜色,当在导航上悬停/活动时,它的一部分将变为另一种颜色.

同样,为什么我的li:hover标签,当我这样做border-top仍然返回我border-bottom

我想在一张照片中实现的目标 如前所述,我也希望在开启时hover,边界过渡将超出图中的绿色边界线.

我怎样才能做到这一点?

这是我到目前为止所拥有的

/*** Page ***/
html,body {
    margin: 0;
}

/*** Navigation ***/
.navbar {
    background-color: #ecf0f1;
}
.navbar > .main-nav > ul,
li {
    list-style-type: none;
    text-decoration: none;
}
.navbar > .main-nav > ul {
    min-height: 60px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    box-sizing: border-box;
    border-top: 8px solid #d1d064;
}
.navbar > .main-nav > ul > li {
    text-align: center;
    min-width: 150px;
    position: relative;
    top: -2px;
    display: …
Run Code Online (Sandbox Code Playgroud)

css html5 css-selectors css3 css-float

6
推荐指数
1
解决办法
417
查看次数