How to align multiple labeled inline block input controls along the same vertical line? [closed]
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I have 4 labeled drop-down controls succeeding one another along the inline document axis. How can I style them so that the control boxes themselves are aligned along the same vertical line?
As you can see, currently the varying height of each label causes the drop-downs to appear at a different point, vertically:
css twitter-bootstrap-3 sass
closed as off-topic by Temani Afif, Pete, Paulie_D, Paolo Forgia, C-Pound Guru Nov 23 '18 at 4:20
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Temani Afif, Pete, Paulie_D, Paolo Forgia, C-Pound Guru
If this question can be reworded to fit the rules in the help center, please edit the question.
|
show 2 more comments
I have 4 labeled drop-down controls succeeding one another along the inline document axis. How can I style them so that the control boxes themselves are aligned along the same vertical line?
As you can see, currently the varying height of each label causes the drop-downs to appear at a different point, vertically:
css twitter-bootstrap-3 sass
closed as off-topic by Temani Afif, Pete, Paulie_D, Paolo Forgia, C-Pound Guru Nov 23 '18 at 4:20
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Temani Afif, Pete, Paulie_D, Paolo Forgia, C-Pound Guru
If this question can be reworded to fit the rules in the help center, please edit the question.
Show your code and I will come with answer
– Snake Eyes
Nov 22 '18 at 12:19
Please show the rendered html rather than whatever that is
– Pete
Nov 22 '18 at 12:29
1
By "input boxes" you mean the labels? The selects in the picture are already all the same height.
– Mr Lister
Nov 22 '18 at 12:38
Sorry, I mean the dropdown boxes. I want them to be align instead of the label
– SpongebobJunior
Nov 22 '18 at 12:40
1
If the elements are not all in the same parent, this is not possible with CSS. You would need JS. There is no CSS method of equalising heights of elements that do not share a parent.
– Paulie_D
Nov 22 '18 at 12:45
|
show 2 more comments
I have 4 labeled drop-down controls succeeding one another along the inline document axis. How can I style them so that the control boxes themselves are aligned along the same vertical line?
As you can see, currently the varying height of each label causes the drop-downs to appear at a different point, vertically:
css twitter-bootstrap-3 sass
I have 4 labeled drop-down controls succeeding one another along the inline document axis. How can I style them so that the control boxes themselves are aligned along the same vertical line?
As you can see, currently the varying height of each label causes the drop-downs to appear at a different point, vertically:
css twitter-bootstrap-3 sass
css twitter-bootstrap-3 sass
edited Nov 22 '18 at 13:01
amn
4,06953563
4,06953563
asked Nov 22 '18 at 12:17
SpongebobJuniorSpongebobJunior
661118
661118
closed as off-topic by Temani Afif, Pete, Paulie_D, Paolo Forgia, C-Pound Guru Nov 23 '18 at 4:20
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Temani Afif, Pete, Paulie_D, Paolo Forgia, C-Pound Guru
If this question can be reworded to fit the rules in the help center, please edit the question.
closed as off-topic by Temani Afif, Pete, Paulie_D, Paolo Forgia, C-Pound Guru Nov 23 '18 at 4:20
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Temani Afif, Pete, Paulie_D, Paolo Forgia, C-Pound Guru
If this question can be reworded to fit the rules in the help center, please edit the question.
Show your code and I will come with answer
– Snake Eyes
Nov 22 '18 at 12:19
Please show the rendered html rather than whatever that is
– Pete
Nov 22 '18 at 12:29
1
By "input boxes" you mean the labels? The selects in the picture are already all the same height.
– Mr Lister
Nov 22 '18 at 12:38
Sorry, I mean the dropdown boxes. I want them to be align instead of the label
– SpongebobJunior
Nov 22 '18 at 12:40
1
If the elements are not all in the same parent, this is not possible with CSS. You would need JS. There is no CSS method of equalising heights of elements that do not share a parent.
– Paulie_D
Nov 22 '18 at 12:45
|
show 2 more comments
Show your code and I will come with answer
– Snake Eyes
Nov 22 '18 at 12:19
Please show the rendered html rather than whatever that is
– Pete
Nov 22 '18 at 12:29
1
By "input boxes" you mean the labels? The selects in the picture are already all the same height.
– Mr Lister
Nov 22 '18 at 12:38
Sorry, I mean the dropdown boxes. I want them to be align instead of the label
– SpongebobJunior
Nov 22 '18 at 12:40
1
If the elements are not all in the same parent, this is not possible with CSS. You would need JS. There is no CSS method of equalising heights of elements that do not share a parent.
– Paulie_D
Nov 22 '18 at 12:45
Show your code and I will come with answer
– Snake Eyes
Nov 22 '18 at 12:19
Show your code and I will come with answer
– Snake Eyes
Nov 22 '18 at 12:19
Please show the rendered html rather than whatever that is
– Pete
Nov 22 '18 at 12:29
Please show the rendered html rather than whatever that is
– Pete
Nov 22 '18 at 12:29
1
1
By "input boxes" you mean the labels? The selects in the picture are already all the same height.
– Mr Lister
Nov 22 '18 at 12:38
By "input boxes" you mean the labels? The selects in the picture are already all the same height.
– Mr Lister
Nov 22 '18 at 12:38
Sorry, I mean the dropdown boxes. I want them to be align instead of the label
– SpongebobJunior
Nov 22 '18 at 12:40
Sorry, I mean the dropdown boxes. I want them to be align instead of the label
– SpongebobJunior
Nov 22 '18 at 12:40
1
1
If the elements are not all in the same parent, this is not possible with CSS. You would need JS. There is no CSS method of equalising heights of elements that do not share a parent.
– Paulie_D
Nov 22 '18 at 12:45
If the elements are not all in the same parent, this is not possible with CSS. You would need JS. There is no CSS method of equalising heights of elements that do not share a parent.
– Paulie_D
Nov 22 '18 at 12:45
|
show 2 more comments
2 Answers
2
active
oldest
votes
That shouldn't be too difficult with a Grid layout:
<div>
<label>Field 1....</label>
<select></select>
<label>Long Field Field Field Field Field</label>
<select></select>
<label>Field 2</label>
<select></select>
<label>Long Field Field Field Field Field</label>
<select></select>
</div>
You make the container a Grid container:
div {
display: grid;
}
And make sure the labels go on the first row only:
div > label {
grid-row: 1;
}
Since your Grid container is a div
it occupies all available space horizontally, and the label text may never wrap. Since you were concerned about input controls being aligned vertically, that will happen even if the labels have different height, you can test with limiting their width with, for instance:
div > label {
max-width: 10em;
}
Don't forget to associate your label
elements each with their respective control (using the for
attribute for the label
).
add a comment |
Try this
HTML
<div class="container">
<div class="row">
<div class="col-md-3 col-sm-3">
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">
</div>
</div>
<div class="col-md-3 col-sm-3">
<div class="form-group">
<label for="exampleInputEmail1">Email addressaaaaaaaaaaaaaaaaaaaa</label>
<input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">
</div>
</div>
</div>
</div>
CSS
.row {
background: #f8f9fa;
margin-top: 20px;
}
.col {
border: solid 1px #6c757d;
padding: 10px;
}
.form-group{
height: 100%;
display:flex;
flex-wrap: wrap;
}
.form-control{
align-self : flex-end;
}
@Paulie_D I have made chages please verify.
– Sagar
Nov 22 '18 at 12:48
Removed it. Height was only for demonstration.
– Sagar
Nov 22 '18 at 12:54
This still doesn't work...you cannot equalise heights of elements that do not share a parent with CSS.
– Paulie_D
Nov 22 '18 at 12:54
Check the same in fiddle. I guess it works
– Sagar
Nov 22 '18 at 12:57
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
That shouldn't be too difficult with a Grid layout:
<div>
<label>Field 1....</label>
<select></select>
<label>Long Field Field Field Field Field</label>
<select></select>
<label>Field 2</label>
<select></select>
<label>Long Field Field Field Field Field</label>
<select></select>
</div>
You make the container a Grid container:
div {
display: grid;
}
And make sure the labels go on the first row only:
div > label {
grid-row: 1;
}
Since your Grid container is a div
it occupies all available space horizontally, and the label text may never wrap. Since you were concerned about input controls being aligned vertically, that will happen even if the labels have different height, you can test with limiting their width with, for instance:
div > label {
max-width: 10em;
}
Don't forget to associate your label
elements each with their respective control (using the for
attribute for the label
).
add a comment |
That shouldn't be too difficult with a Grid layout:
<div>
<label>Field 1....</label>
<select></select>
<label>Long Field Field Field Field Field</label>
<select></select>
<label>Field 2</label>
<select></select>
<label>Long Field Field Field Field Field</label>
<select></select>
</div>
You make the container a Grid container:
div {
display: grid;
}
And make sure the labels go on the first row only:
div > label {
grid-row: 1;
}
Since your Grid container is a div
it occupies all available space horizontally, and the label text may never wrap. Since you were concerned about input controls being aligned vertically, that will happen even if the labels have different height, you can test with limiting their width with, for instance:
div > label {
max-width: 10em;
}
Don't forget to associate your label
elements each with their respective control (using the for
attribute for the label
).
add a comment |
That shouldn't be too difficult with a Grid layout:
<div>
<label>Field 1....</label>
<select></select>
<label>Long Field Field Field Field Field</label>
<select></select>
<label>Field 2</label>
<select></select>
<label>Long Field Field Field Field Field</label>
<select></select>
</div>
You make the container a Grid container:
div {
display: grid;
}
And make sure the labels go on the first row only:
div > label {
grid-row: 1;
}
Since your Grid container is a div
it occupies all available space horizontally, and the label text may never wrap. Since you were concerned about input controls being aligned vertically, that will happen even if the labels have different height, you can test with limiting their width with, for instance:
div > label {
max-width: 10em;
}
Don't forget to associate your label
elements each with their respective control (using the for
attribute for the label
).
That shouldn't be too difficult with a Grid layout:
<div>
<label>Field 1....</label>
<select></select>
<label>Long Field Field Field Field Field</label>
<select></select>
<label>Field 2</label>
<select></select>
<label>Long Field Field Field Field Field</label>
<select></select>
</div>
You make the container a Grid container:
div {
display: grid;
}
And make sure the labels go on the first row only:
div > label {
grid-row: 1;
}
Since your Grid container is a div
it occupies all available space horizontally, and the label text may never wrap. Since you were concerned about input controls being aligned vertically, that will happen even if the labels have different height, you can test with limiting their width with, for instance:
div > label {
max-width: 10em;
}
Don't forget to associate your label
elements each with their respective control (using the for
attribute for the label
).
edited Nov 22 '18 at 13:24
answered Nov 22 '18 at 13:14
amnamn
4,06953563
4,06953563
add a comment |
add a comment |
Try this
HTML
<div class="container">
<div class="row">
<div class="col-md-3 col-sm-3">
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">
</div>
</div>
<div class="col-md-3 col-sm-3">
<div class="form-group">
<label for="exampleInputEmail1">Email addressaaaaaaaaaaaaaaaaaaaa</label>
<input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">
</div>
</div>
</div>
</div>
CSS
.row {
background: #f8f9fa;
margin-top: 20px;
}
.col {
border: solid 1px #6c757d;
padding: 10px;
}
.form-group{
height: 100%;
display:flex;
flex-wrap: wrap;
}
.form-control{
align-self : flex-end;
}
@Paulie_D I have made chages please verify.
– Sagar
Nov 22 '18 at 12:48
Removed it. Height was only for demonstration.
– Sagar
Nov 22 '18 at 12:54
This still doesn't work...you cannot equalise heights of elements that do not share a parent with CSS.
– Paulie_D
Nov 22 '18 at 12:54
Check the same in fiddle. I guess it works
– Sagar
Nov 22 '18 at 12:57
add a comment |
Try this
HTML
<div class="container">
<div class="row">
<div class="col-md-3 col-sm-3">
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">
</div>
</div>
<div class="col-md-3 col-sm-3">
<div class="form-group">
<label for="exampleInputEmail1">Email addressaaaaaaaaaaaaaaaaaaaa</label>
<input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">
</div>
</div>
</div>
</div>
CSS
.row {
background: #f8f9fa;
margin-top: 20px;
}
.col {
border: solid 1px #6c757d;
padding: 10px;
}
.form-group{
height: 100%;
display:flex;
flex-wrap: wrap;
}
.form-control{
align-self : flex-end;
}
@Paulie_D I have made chages please verify.
– Sagar
Nov 22 '18 at 12:48
Removed it. Height was only for demonstration.
– Sagar
Nov 22 '18 at 12:54
This still doesn't work...you cannot equalise heights of elements that do not share a parent with CSS.
– Paulie_D
Nov 22 '18 at 12:54
Check the same in fiddle. I guess it works
– Sagar
Nov 22 '18 at 12:57
add a comment |
Try this
HTML
<div class="container">
<div class="row">
<div class="col-md-3 col-sm-3">
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">
</div>
</div>
<div class="col-md-3 col-sm-3">
<div class="form-group">
<label for="exampleInputEmail1">Email addressaaaaaaaaaaaaaaaaaaaa</label>
<input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">
</div>
</div>
</div>
</div>
CSS
.row {
background: #f8f9fa;
margin-top: 20px;
}
.col {
border: solid 1px #6c757d;
padding: 10px;
}
.form-group{
height: 100%;
display:flex;
flex-wrap: wrap;
}
.form-control{
align-self : flex-end;
}
Try this
HTML
<div class="container">
<div class="row">
<div class="col-md-3 col-sm-3">
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">
</div>
</div>
<div class="col-md-3 col-sm-3">
<div class="form-group">
<label for="exampleInputEmail1">Email addressaaaaaaaaaaaaaaaaaaaa</label>
<input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">
</div>
</div>
</div>
</div>
CSS
.row {
background: #f8f9fa;
margin-top: 20px;
}
.col {
border: solid 1px #6c757d;
padding: 10px;
}
.form-group{
height: 100%;
display:flex;
flex-wrap: wrap;
}
.form-control{
align-self : flex-end;
}
edited Nov 22 '18 at 12:53
answered Nov 22 '18 at 12:44
SagarSagar
490211
490211
@Paulie_D I have made chages please verify.
– Sagar
Nov 22 '18 at 12:48
Removed it. Height was only for demonstration.
– Sagar
Nov 22 '18 at 12:54
This still doesn't work...you cannot equalise heights of elements that do not share a parent with CSS.
– Paulie_D
Nov 22 '18 at 12:54
Check the same in fiddle. I guess it works
– Sagar
Nov 22 '18 at 12:57
add a comment |
@Paulie_D I have made chages please verify.
– Sagar
Nov 22 '18 at 12:48
Removed it. Height was only for demonstration.
– Sagar
Nov 22 '18 at 12:54
This still doesn't work...you cannot equalise heights of elements that do not share a parent with CSS.
– Paulie_D
Nov 22 '18 at 12:54
Check the same in fiddle. I guess it works
– Sagar
Nov 22 '18 at 12:57
@Paulie_D I have made chages please verify.
– Sagar
Nov 22 '18 at 12:48
@Paulie_D I have made chages please verify.
– Sagar
Nov 22 '18 at 12:48
Removed it. Height was only for demonstration.
– Sagar
Nov 22 '18 at 12:54
Removed it. Height was only for demonstration.
– Sagar
Nov 22 '18 at 12:54
This still doesn't work...you cannot equalise heights of elements that do not share a parent with CSS.
– Paulie_D
Nov 22 '18 at 12:54
This still doesn't work...you cannot equalise heights of elements that do not share a parent with CSS.
– Paulie_D
Nov 22 '18 at 12:54
Check the same in fiddle. I guess it works
– Sagar
Nov 22 '18 at 12:57
Check the same in fiddle. I guess it works
– Sagar
Nov 22 '18 at 12:57
add a comment |
Show your code and I will come with answer
– Snake Eyes
Nov 22 '18 at 12:19
Please show the rendered html rather than whatever that is
– Pete
Nov 22 '18 at 12:29
1
By "input boxes" you mean the labels? The selects in the picture are already all the same height.
– Mr Lister
Nov 22 '18 at 12:38
Sorry, I mean the dropdown boxes. I want them to be align instead of the label
– SpongebobJunior
Nov 22 '18 at 12:40
1
If the elements are not all in the same parent, this is not possible with CSS. You would need JS. There is no CSS method of equalising heights of elements that do not share a parent.
– Paulie_D
Nov 22 '18 at 12:45