I have two labels in a horizontal UIStackView
. Label 1 is a large font (the alarm time), Label 2 is a small font (AM/PM indicator) and I want to align the bottoms of each label.
I have the alignment of the stack view set to Bottom, but it seems like it's just aligning the bottoms of the labels' total area and not the actual text. The result is that the smaller font's bottom edge is about 3 or 4 pixels above the bottom edge of the large label. How do I fix this?
Example of right aligning labels next to inputs with the text-align property: We can remove the text-align property, and the labels will be left-aligned by default. Let’s see an example, where we also add placeholder, id and name attributes on inputs and for attribute on labels. As a result, the input will be activated when a label is clicked.
Use the .form-horizontal class in Bootstrap to align labels and groups of form controls in a horizontal layout. You can try to run the following code to implement .form-horizontal class:
It is clearly visible that the use of the <div> tag took the second link on the other line because it acquires the entire line width. If <div> was an inline tag, then by default two divs would align horizontally. Ways to align 2 divs horizontally: We have two divs that can be aligned horizontally with the use of CSS.
Here, 2 anchor tags are used. Since the anchor tag is an inline element, the second link comes right after the first one in the output. However, the second link can be made to go to the next line if we use the <div> tag.
You need check BaseLine Relative
attribute in VERTICAL Stack
view
For Horizontal stackview
You need to change alignment from fill mode to either First baseline
or Last baseline
If you want to know about baseline here isa great explanation https://stackoverflow.com/a/24541992/4601900
Hope it is helpful to you
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With