Using Html Label element with a fixed width

You may want to use Label juxtaposed with input element and want those label to be with a fixed width. This can be the case if have some column done with division and you want to have all label to be aligned on the left and having all their input control aligned left but at the same distance and not depending of the text’s size. For that, you want a fixed width for all label. This can be done by setting the width but also setting the display to block instead of inline. Also, you will need to make it floats.

label {
    display: block;
    float: left;
    width: 200px;

If you like my article, think to buy my annual book, professionally edited by a proofreader. directly from me or on Amazon. I also wrote a TypeScript book called Holistic TypeScript

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.