Date picker not aligned when there is fixed top menu on page in bootstrap.
See original GitHub issueWhen there is a fixed top menu on page in bootstrap we have to add some element with margin top or to add margin to body.
In that case the datepicker is out of input element basically it is shown over input element because it calculates element style top in my case 50px less.
So for example if i open datepicker and inspect with div with datepicker class i see
element.style {
display: block;
left: 1261.5px;
top: 176.8px;
}
If i edit that and add 50px, the datepicker shows in place. I can add margin-top: 50px to datepicker class and it would work but that is just quick fix for my specific case.
Issue Analytics
- State:
- Created 8 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Bootstrap Datepicker: Misaligned - Stack Overflow
What's the easiest work around? Adding a fixed top margin through javascript would work but is incredibly hacky. Is there a better solution?...
Read more >Is there a way to center an embedded datepicker inside a <div>?
Problem is: it doesn't go to the center of its available space. A 50% padding-left goes way too far and adjustements do not...
Read more >Input group - Bootstrap
Easily extend form controls by adding text, buttons, or button groups on either side of textual inputs, custom selects, and custom file inputs....
Read more >Tables · Bootstrap v5.0
Due to the widespread use of <table> elements across third-party widgets like calendars and date pickers, Bootstrap's tables are opt-in.
Read more >Forms - Bootstrap
If your form layout allows it, you can swap the .{valid|invalid}-feedback classes for .{valid|invalid}-tooltip classes to display validation feedback in a ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is not a solution … rather a work around. Calculate the height of the menu at the top and add it to the datepicker on “show”.
Yep @fernandowalla is correct, for some reason my body had margin-top instead of padding-top for my fixed nav.
Fixed with this: -
body { padding-top: 60px; }