输入类型复选框不能正确设置样式

时间:2019-09-30 08:19:20

标签: html css

我想设置一个复选框的样式,虽然我没有标签,但是我的样式未应用于该输入,我无法弄清楚为什么。在此之前,我问我在堆栈中遇到了类似的问题溢出,但对我没有用。我将在此添加我的codepen示例。

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>title</title>
  </head>
  <body>
    <input type="checkbox" value="">
   </body>
</html>

我的风格

input[type=checkbox]:before {
  background-color: #00f279;
  border-color: #000000;
  color: #ffffff;
}

input[type=checkbox] {
     transform: scale(1.5);
     -ms-transform: scale(1.5);
     -webkit-transform: scale(1.5);
      padding: 5px;
      vertical-align: middle;
      background-color :#ffffff;
 }

CodePen Demo

2 个答案:

答案 0 :(得分:2)

您必须申请public class MyEntity : IEntity { // make sure: public int Id { get; set; } // or: [Key] public int SomeProperty { get; set; } } 。这将删除所有浏览器样式,然后您尝试应用样式。

time_allowance = 15
close_out = []
i=0
for index, row in df.iterrows():
    i+=1

    idf = df.loc[(df['Origin'] == row['Origin']) &
                 (df['Month'] == row['Month']) &
                 (df['DayofMonth'] == row['DayofMonth']) &
                 (df['DepTime'] < row['DepTime'] + time_allowance) &
                 (df['DepTime'] > row['DepTime'] - time_allowance), :]

    close_out.append(len(idf))   

col_name = 'close_out' + str(time_allowance)
df[col_name] = close_out

}

现在处于选中状态,您必须将另一个CSS与背景图像一起应用。

答案 1 :(得分:0)

在[||之后]

还添加高度宽度在]之前,您还需要在CSS中添加(内容也是)

签出此

input[type=checkbox]:before {
  content:'x';
  background-color: #00f279;
  border-color: #000000;
  color: #ffffff;
}

input[type=checkbox] {
     transform: scale(1.5);
     -ms-transform: scale(1.5);
     -webkit-transform: scale(1.5);
      padding: 5px;
      vertical-align: middle;
      background-color :#ffffff;
  height: 20px;
    width: 20px;
 }