The best way to create a div with the label "Label": "Text box" and is it well focused?

What is the best way to have the following?

Name: [Textbox]

Inside a div? I find that the name: the part does not go well with the text box, especially with a small font. I want the name: the part is centered vertically.

In some cases, the left side can be quite long and wrap on several lines, for example:

All known
addresses: [Textbox]

Again, I would like the left side to be well centered.

I am trying to stop using tables for layout and switch to div so that I can do everything right, but I am having some problems. style="vertical-align:middle"doesn't seem to be doing anything.

+3
source share
3 answers

There is no good way to do this. There is a decent entry for some of the methods here , but most of them rely on hacker elements with a fixed height or using layouts of tables and tables on divs.

If you focus on things, this is a difficult requirement, I just refuse and use tables

+5
source

use tables or 2 divs: one for the label and another for your text box so you can align them correctly.

0
source
-1

Source: https://habr.com/ru/post/1717583/


All Articles