Cómo obtener la altura de una fila en un flexbox Si tuviera un contenedor flexbox y dentro de ese contenedor, había 3 filas diferentes, ¿sería posible tal vez con javascript recuperar la altura de cada fila, por ejemplo, si quisiera obtener la altura de la segunda fila en el flexbox ¿sería esa una posibilidad?
Podría lograr esto creando una array con todos los elementos que tienen la misma clase, y luego con forEach podría obtener la altura de todos estos elementos. Por ejemplo:
let arrayName = document.querySelectorAll(".your-row"); //gets every single element that has the your-row class. arrayName.forEach(element => console.log(element.clientHeight)); /* loops through the element and for each element it prints the height to the console including padding but NOT the horizontal scrollbar height, border, or margin. */Si desea obtener la altura del segundo elemento, por ejemplo, solo necesitaría usar la misma matriz y especificar que desea obtener el segundo. Por ejemplo:
let arrayName = document.querySelectorAll(".your-row"); //Getting all elements again. console.log(arrayName[1].clientHeight); // Log the 2nd elements height into the console.