2016-05-02 30 views
0

將呼叫字段的複選框的寬度設置爲25像素,僅當左邊距清晰時才顯示。在css中更改複選框的寬度

不知道爲什麼我不能弄清楚,它可能是簡單的,再次。我確信我的樣式表和一切都匹配這次。

這裏是該項目的HTML代碼:

<p><input type="checkbox" name="call" id="call"></p> 
<p><label for="call">Please contact me for a "Get to Know You" visit.</label></p> 

這裏是CSS我想要使用:

.checkbox { 
float: left; 
clear: left; 
width: 25px; } 

This is what the form is suppose to look like (don't mind the submit and cancel buttons, havent got there yet

Here is what mine looks like with the current CSS

有一個特定的選擇器只是物理複選框?爲什麼它一直在表格的角落?

// - UPDATE - // 我在輸入屬性中添加了class =「checkbox」,複選框移動到了正確的位置。

現在標籤「請聯繫我一個」瞭解你「訪問。」將無法正確對齊。假設複選框設置爲自動後直接具有寬度,並且清除屬性的值爲無。我嘗試了所有我能想到的,但我無法把它排隊。我應該使用什麼選擇器?

+0

題外話,但我希望這些細節在圖像中不是真實的。 –

+0

你在哪裏定義了輸入中的類?添加class ='複選框' – AceLearn

+0

你想改變複選框的寬度或大小? – AceLearn

回答

0

我認爲我們需要更多的細節來說明你對複選框的寬度的含義。但是在應用的複選框的CSS方面,您可能需要您的輸入指定一個類或限制css來輸入[類型=複選框]

.checkbox { 
 
float: left; 
 
clear: left; 
 
width: 25px; } 
 

 
input[type=checkbox] { 
 
float: left; 
 
clear: left; 
 
width: 25px; }
<p><input class="checkbox" type="checkbox" name="call" id="call"></p> 
 
<p><label for="call">Please contact me for a "Get to Know You" visit.</label></p> 
 
    
 
<hr/> 
 

 
<p><input type="checkbox" name="call" id="call"></p> 
 
<p><label for="call">Please contact me for a "Get to Know You" visit.</label></p>

+0

我希望我能,那些是我給的確切指示。 –

+0

我希望別人知道這個問題的含義。 –

+0

那麼類選擇器的工作,它在正確的地方,如果它的大小不同,idk,但我認爲這就是我需要的。謝謝Nathan :) –