Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
157 views
in Technique[技术] by (71.8m points)

javascript - Align inputs in different td horizontally

I am trying to align 2 inputs in 2 different td tag to align horizontally. Moreover, when input has been appended into td, it will cover the td text

enter image description here

There are 2 cases:

  • When both of td have text or empty, then everything is OK.
  • When one of the 2 td has text, they do not align on same line

This is my source code I have tried: https://jsfiddle.net/oc8Lgm3y/2/

question from:https://stackoverflow.com/questions/65913952/align-inputs-in-different-td-horizontally

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

you can add vertical-align:bottom; to the td,th.

You can check the source code here: https://jsfiddle.net/k1gapfmq/

table {
  font-family: arial, sans-serif;
  border-collapse: collapse;
  width: 50%;
}

td, th {
  border: 1px solid #dddddd;
  text-align: left;
  vertical-align: bottom;
  padding: 8px;
}

input[name=^='product'] {
  background-color: red;
}

html table


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...