我的問題是,它們相互重疊:https : //i.stack.imgur.com/ltZ8w.png
我需要這樣做: https : //i.stack.imgur.com/roBun.png
我能做什么?我只需要在我的輸入復選框中輸入文本,就像我在圖片中顯示的那樣,有什么建議嗎?
.round {
position: relative;
margin-left: 50px;
}
.round label {
background-color: #fff;
border: 1px solid #ccc;
border-radius: 50%;
cursor: pointer;
height: 28px;
left: 0;
position: absolute;
top: 0;
width: 28px;
}
.round label:after {
border: 2px solid #fff;
border-top: none;
border-right: none;
content: "";
height: 6px;
left: 7px;
opacity: 0;
position: absolute;
top: 8px;
transform: rotate(-45deg);
width: 12px;
}
.round input[type="checkbox"] {
visibility: hidden;
}
.round input[type="checkbox"]:checked label {
background-color: #66bb6a;
border-color: #66bb6a;
text-decoration: line-through;
color: #3CC070;
}
.tasks input[type="checkbox"]:checked label {
border-color: #66bb6a;
text-decoration: line-through;
color: #3CC070;
}
.round input[type="checkbox"]:checked label:after {
opacity: 1;
}
<div>
<div> <input type="checkbox" class="input" checked>
<label>Make some cash</label>
</div>
<div class="round">
<input type="checkbox" id="checkbox" />
<label for="checkbox" class="text"> Make</label>
</div>
</div>
uj5u.com熱心網友回復:
您可以Before為label它添加偽代碼并在其中添加文本。
移除標簽內容 <label for="checkbox" ></label>
label.text:before {
content: "click";
display: inline-block;
left: 37px;
position: absolute;
top: 4px;
}
.round {
position: relative;
margin-left: 50px;
}
.round label {
background-color: #fff;
border: 1px solid #ccc;
border-radius: 50%;
cursor: pointer;
height: 28px;
left: 0;
position: absolute;
top: 0;
width: 28px;
}
label.text:before {
content: "click";
display: inline-block;
left: 37px;
position: absolute;
top: 4px;
}
.round label:after {
border: 2px solid #fff;
border-top: none;
border-right: none;
content: "";
height: 6px;
left: 7px;
opacity: 0;
position: absolute;
top: 8px;
transform: rotate(-45deg);
width: 12px;
}
.round input[type="checkbox"] {
visibility: hidden;
}
.round input[type="checkbox"]:checked label {
background-color: #66bb6a;
border-color: #66bb6a;
text-decoration: line-through;
color: #3CC070;
}
.tasks input[type="checkbox"]:checked label {
border-color: #66bb6a;
text-decoration: line-through;
color: #3CC070;
}
.round input[type="checkbox"]:checked label:after {
opacity: 1;
}
<div>
<div> <input type="checkbox" class="input" checked>
<label>Make some cash</label>
</div>
<div class="round">
<input type="checkbox" id="checkbox" />
<label for="checkbox" class="text"></label>
</div>
</div>
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/387166.html
上一篇:使用flexbox在不同位置對齊標題和div中的輸入
下一篇:在頁面上居中回應矩陣
