How to center align the label and the textbox in HTML horizontally in webpage

Steps to align textbox and label

Step 1: Center a div tag using margin as `0 auto`.

Step 2: Align the label to right and make it float to left.

Step 3: Align the textbox to left and make it float to right.

Step 4: Make both label and textbox to inline-block.

HTML  & CSS

Live demo here: https://jsfiddle.net/durtpwvx/

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.