I recently modified some previously written code and found some problems. For example, the two divs must dynamically maintain the same height. Original practice: divstyleoverflow: hiddendividleftstylemargin-bottom:-pixel PX; padding-bottom: pixel PX; divdividrightstylemargin-bottom:-pixel PX; padding-B
I recently modified some previously written code and found some problems. For example, two p must dynamically maintain the same height. The original practice was: p style = overflow: hidden p id = left style = margin-bottom:-pixel PX; padding-bottom: pixel PX; /p id = right style = margin-bottom:-adjust PX; padding-B
I recently modified some previously written code and found some problems.
For example, two p must dynamically maintain the same height.
The original practice was as follows:
If the actual height is not greater than pixel PX, there is no problem. If the actual height of one side is greater than pixel PX, the height of the other side can only be defined as pixel PX, does not meet the actual needs.
After testing, js can solve this problem.
The Code is as follows:
Var h = document. getElementById ("left"). offsetHeight> document. getElementById ("right"). offsetHeight? Document. getElementById ("left"). offsetHeight: document. getElementById ("right"). offsetHeight;
Document. getElementById ("ztleft"). style. height = document. getElementById ("ztright"). style. height = h + "px ";
If it is a dynamically generated p, as long as you try to get the id and store it in the js array, the problem can also be simply solved using loops.