我正在尝试使用以下方式设置复选框的样式:
<input type="checkbox" style="border:2px dotted #00f;display:block;background:#ff0000;" />Run Code Online (Sandbox Code Playgroud)
但风格并未适用.该复选框仍显示其默认样式.我如何给它指定的样式?
有没有办法将Bootstraps 4 beta复选框大小更改为更大的?
我几乎尝试改变风格,但这不起作用.
谢谢!
我想将我的复选框更改为这种颜色#FA9E57。我正在使用 bootstrap v 4.6。
这是我的复选框代码:
input[type=checkbox]{
width: 20px;
height: 20px;
background-color: #FA9E57;
}
input[type=checkbox]:checked{
background-color: #FA9E57;
}Run Code Online (Sandbox Code Playgroud)
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="register.css">
<title><%=judul %></title>
<body>
<div class="form-group my-4">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="privacy">
<label class="form-check-label ml-3" for="privacy">
Agree privacy
</label>
</div>
</div>
</body>Run Code Online (Sandbox Code Playgroud)
我不知道如何更改此 Bootstrap 4 切换开关的“选中”背景颜色。它使用额外的库来切换深色和浅色模式 \xe2\x80\x93 Here on github \xe2\x80\x93 但这是有效的。我想要做的就是更改活动复选框的背景颜色,默认情况下为蓝色。Bootstrap CSS 默认为蓝色吗?这个答案更改 Bootstrap 4 复选框背景颜色对我不起作用;它更改了未选中的颜色,但我无法从中 grep 如何更改选中的颜色。
\n\n我的代码在这里:
\n.custom-control-input {\n background-color: red;\n}Run Code Online (Sandbox Code Playgroud)\r\n<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">\n<div class="custom-control custom-switch">\n <input type="checkbox" class="custom-control-input" id="darkSwitch" />\n <label class="custom-control-label" for="darkSwitch">Dark Mode</label>\n</div>Run Code Online (Sandbox Code Playgroud)\r\n