<form>
<div class="row form-check">
<label class="form-check-label" for="communes">Sélectionnez une commune :</label>
<app-communes id="communes" anneeCOG="2023"></app-communes>
</div>
</form>
<div class="row">
<div class="carte_metropole" id="carte_metropole" ></div>
</div>
[...]
fails to display the label and its selector the way I want:
(I would like to have:
Sélectionnez une commune : [Tapez le nom de la commune]
left aligned horizontally)
<app-communes ...>
leads here:
<div class="form-check-input">
<input type="text" list="communesCOG" [(ngModel)]="libelleCommuneSelectionnee" (ngModelChange)="selectCommune($event)"
placeholder="Tapez le nom de la commune">
<datalist id="communesCOG">
<option *ngFor="let commune of communes" [value]="commune.codeCommune">{{commune.nomCommune}} ({{commune.nomDepartement}})</option>
</datalist>
</div>
I’ve attempted css classes and nestings I’ve found over the Internet, but eventually I’m confused.
@Arleigh_Hix I believe I’ve done what you suggested me, but it isn’t producing the result you have in your demonstration.
2
Answers
.form-check-input
is forinput[type="checkbox"]
notinput[type="text"]
.You should remove the
.form-check
class from yourdiv.row
, replace.form-check-label
with.form-label
, and thediv.form-check-input
is not needed.Make use of
.col-*
classes for a horizontal form.https://getbootstrap.com/docs/5.3/forms/overview/#overview
You can use
d-flex
to align items horizontally:communes component: