I want to insert a line break using CSS, there are two classes : select2-search-field and select2-search-choice they are coming in same div as li element Could please suggest any way I could break them to populate in two lines.
I have tried : How to insert a line break before an element using CSS
Following is the code snippet for which I want to achieve line break in
<div class="counterPartyId">
<ul class="select2-choices">
<li class="select2-search-choice">
<div>ABN nv,</div>
</li>
<li class="select2-search-field" >
<label for="s2id_autogen5" class="select2-offscreen"></label>
<input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" class="select2-input" id="s2id_autogen5" placeholder="" style="width: 103px;" aria-activedescendant="select2-result-label-7">
</li>
</ul>
</div>
Anzil khaN
1,9841 gold badge22 silver badges32 bronze badges
2 Answers 2
use css code " display: block "
li {
display: block;
}
<div class="counterPartyId">
<ul class="select2-choices">
<li class="select2-search-choice">
<div>ABN nv,</div>
</li>
<li class="select2-search-field" >
<label for="s2id_autogen5" class="select2-offscreen"></label> <input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" class="select2-input" id="s2id_autogen5" placeholder="" style="width: 103px;" aria-activedescendant="select2-result-label-7">
</li>
</ul>
</div>
answered Mar 6, 2018 at 8:13
Saw Zin Min Tun
6423 silver badges9 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
You just need to add 'display: block' to the li's if you want them to occupy each one row
ul li { display: block; }
<div class="counterPartyId">
<ul class="select2-choices">
<li class="select2-search-choice">
<div>ABN nv,</div>
</li>
<li class="select2-search-field" >
<label for="s2id_autogen5" class="select2-offscreen"></label>
<input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" class="select2-input" id="s2id_autogen5" placeholder="" style="width: 103px;" aria-activedescendant="select2-result-label-7">
</li>
</ul>
</div>
answered Mar 6, 2018 at 8:10
LS_
7,16711 gold badges60 silver badges95 bronze badges
Comments
default
li.select2-search-choice, li.select2-search-field { display: block; }