簡體   English   中英

CSS換行屬性不適用於Bootstrap中的標簽標記

[英]CSS word-wrap property not working for label tag in Bootstrap

我在引導程序上有一個問答游戲設置。 這是代碼:

<div class="col-md-12">
   <div class="row">
      <div class="col-md-12" style="padding-bottom:20px; text-align:center;">
         <h1>4 . In the three stage theory of memory, the first stage is called short-term memory.</h1>
      </div>
   </div>
   <div class="row">
      <div class="col-md-6">
         <label class="btn btn-primary" style="font-size:25px; width:100%;" id="label_4_A">
         <input type="radio" name="224" value="A" id="option_4_A"> TRUE                                 </label>
      </div>
      <div class="col-md-6">
         <label class="btn btn-primary" style="font-size:25px; width:100%;" id="label_4_B">
         <input type="radio" name="224" value="B" id="option_4_B"> FALSE                                    </label>
      </div>
   </div>
   <div class="row">
      <div class="col-md-6">
         <label class="btn btn-primary" style="font-size:25px; width:100%;" id="label_4_C">
         <input type="radio" name="224" value="C" id="option_4_C"> Partially True                                   </label>
      </div>
      <div class="col-md-6">
         <label class="btn btn-primary" style="font-size:25px; width:100%;" id="label_4_D">
         <input type="radio" name="224" value="D" id="option_4_D"> Partially False                                  </label>
      </div>
   </div>
   <hr>
   <input type="button" name="next2" value="Next" id="nt" onclick="hideandshow('4','5') " class="btn btn-success">  
   <input type="hidden" value="3" name="game_id">
</div>

問題出在標簽上。 當標簽文本長於列的寬度時,該文本消失。 我希望它自動中斷並繼續換行。 我嘗試使用

<label class="btn btn-primary" style="font-size:25px; width:100%; word-wrap: break-word;" id="label_4_B">

但我認為它似乎不適用於標簽。 如果能從這個社區獲得幫助,那將是非常好的。 謝謝。

你需要覆蓋white-space屬性,它引導設置為nowrap.btn

 label.btn { white-space: initial; } .col-md-12 { width: 200px } 
 <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> <div class="col-md-12"> <div class="row"> <div class="col-md-12" style="padding-bottom:20px; text-align:center;"> <h1>4 . In the three stage theory of memory, the first stage is called short-term memory.</h1> </div> </div> <div class="row"> <div class="col-md-6"> <label class="btn btn-primary" style="font-size:25px; width:100%;" id="label_4_A"> <input type="radio" name="224" value="A" id="option_4_A"> TRUE </label> </div> <div class="col-md-6"> <label class="btn btn-primary" style="font-size:25px; width:100%;" id="label_4_B"> <input type="radio" name="224" value="B" id="option_4_B"> FALSE </label> </div> </div> <div class="row"> <div class="col-md-6"> <label class="btn btn-primary" style="font-size:25px; width:100%;" id="label_4_C"> <input type="radio" name="224" value="C" id="option_4_C"> Partially True </label> </div> <div class="col-md-6"> <label class="btn btn-primary" style="font-size:25px; width:100%;" id="label_4_D"> <input type="radio" name="224" value="D" id="option_4_D"> Partially False </label> </div> </div> <hr> <input type="button" name="next2" value="Next" id="nt" onclick="hideandshow('4','5') " class="btn btn-success"> <input type="hidden" value="3" name="game_id"> </div> 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM