2017-07-19 43 views
1

我試圖給按鈕後的標籤,但按鈕不出現。 是在小提琴工作,但不是在我的本地代碼。標籤後不出現按鈕?

請解決問題。

<div style="float:left;padding-top:5px;"> 
 
    <span class="newrdb"> 
 
    <label for="all" style="padding-left:15px;padding-bottom:8px;width:100px;font-size:12px;float:left"> 
 
            Default Template 
 
    <input type="radio" name="Template" id="all" value="Default Template" checked=""> 
 
    </label> 
 
    </span> 
 
</div>

+0

無無我的要求是有一個輸入字段bu我希望按鈕出現在文本 – Sree11

+0

@ThisGuyHasTwoThumbs根據W3的罰款。 「_要隱式地將標籤與另一個控件相關聯,控件元素必須位於LABEL元素的內容中」https://www.w3.org/TR/html401/interact/forms.html#edef-LABEL「。另請參閱https://stackoverflow.com/questions/774054/should-i-put-input-tags-inside-a-label-tag – ADyson

+0

@ADyson啊我看到,從來沒有見過它完成,似乎,對我來說,不合邏輯的,但那只是我:)我會刪除我的評論 – ThisGuyHasTwoThumbs

回答

5

簡單的解決方案..取下labelwidth:100px;或給它更多的像素...
的問題是,既元素(在文本單選按鈕)不能合在一個100px元素內。所以刪除它使它更寬,它們將融合在一起。

<div style="float:left;padding-top:5px;"> 
 
    <span class="newrdb"> 
 
      <label for="all" style="padding-left:15px;padding-bottom:8px;font-size:12px;float:left"> 
 
       Default Template 
 
       <input type="radio" name="Template" id="all" value="Default Template" checked=""> 
 
      </label> 
 
    </span> 
 
</div>

2

請輸入字段標籤標籤之外,

嘗試下面的代碼,

<div style="float:left;padding-top:5px;"> 
 
    <span class="newrdb"> 
 
    <label for="all" style="padding-left:15px;padding-bottom:8px;font-size:12px;float:left;"> 
 
Default Template 
 
    </label> 
 
    <input type="radio" name="Template" id="all" value="Default Template" checked=""> 
 

 
</span> 
 
</div>

+0

永不離開的代碼 - 總是添加一個解釋:) – ThisGuyHasTwoThumbs

+0

雅肯定,完成... :) – Santhoshkumar

+0

酷刪除downvote: )雖然我會說,看看OP的問題的評論 - 我也認爲這是無效的標記,但感謝@ADyson - 事實證明這是完全有效的,也許不是最佳做法 – ThisGuyHasTwoThumbs