[Vuejs]-Get the last div top css in vuejs

3👍

in ur case, i will using ref to get lastChildElement div by using lastElementChild

First, to get the last child element

this.$refs.busstop.lastElementChild

and to style for this element

this.$refs.busstop.lastElementChild.style.fontSize = "30px";

like that

1👍

Alright, so if I understand properly, you want to:

  • have a parent w/ a reference
  • select the last element of this specific parent
  • get it’s window’s position from the top ?

Here is a demo on how to do this in CSS + Vue.
https://codesandbox.io/s/jovial-fog-td190?file=/src/App.vue

Leave a comment