question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't vertically center text inside b-form-group

See original GitHub issue

Describe the bug

Having a form group which in some cases has plain text rather than a form-input. That text should be vertically centered:

 <b-form-group label-cols="4" label-cols-lg="2" label="Default" label-for="input-default">
    Password goes here
  </b-form-group>

With plain Bootstrap 4, it is possible by setting align-self-center for the parent node: https://stackoverflow.com/questions/58353571/bootstrap-4-vertical-center-text-inside-horizontal-form-row

but in bootstrap-vue markup above there’s no such node.

The generated markup has the node, and applying the align-self-center class in Inspector works:

<div class="col">Password goes here</div>

How to generate this markup?

<div class="col align-self-center">Password goes here</div>

Expected behavior

A way to apply a class to container node which holds the <b-form-group> content after the label.

Versions

2.0.4

Thanks!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
mariusacommented, Oct 12, 2019

Thanks Troy!

Both solutions are good for the simplified request as posted. We need to display HTML, not just plain text though, and also a form control in same cases.

So I just went with a class applied on b-form-group:

.form-align-self-center {
  div {
    div {
      align-self: center !important;
    }
  }
}

Thanks for your support!

0reactions
mariusacommented, Oct 12, 2019

Thanks so much!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vertical Align form-group bootstrap - Stack Overflow
@NenadVracar i want to aling my button inside of his column, for example the column have 400px of height, and i wish my...
Read more >
Forms - Bootstrap
form-group class is the easiest way to add some structure to forms. It provides a flexible class that encourages proper grouping of labels,...
Read more >
How to vertically center text with CSS ? - GeeksforGeeks
In this article, we will learn how to align the text vertically using CSS & Although CSS2 doesn't support Vertical aligning.
Read more >
Bootstrap Vertical alignment - examples & tutorial
Bootstrap 5 vertical alignment utilities position elements on the y-axis. You can center your content with it or align it to the top...
Read more >
[Best solution]-Bootstrap 3 vertical align in div doesn't work
It is top aligned, but unless you change the height it will look the same as middle or bottom aligned. What you have...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found