Question about parent and children function in jQuery

So these two functions basically give i.e. a color of element to the element thats above or bellow it?
for example if i have h2 with color red, and use i.e. parent it will give color red to element above it? Same goes for children functions but it gives i.e. color to the element bellow it? Did i understand this well?

@Bego96,
$.parent() and $.children() do not deal with styling of parent/child elements.
They return either the parent element or the children elements of the element you activate the method on.
Would recommend you read up on them below.

https://api.jquery.com/parent/

https://api.jquery.com/children/

Here

But parent() has still given element above a color of element thats bellow it, and i checked those links and read it, it basically says it turns to the elements ancestors, so if i that element has a color of red and use parents function for example it will give elements that are above it color red all the way up to beggining from my understanding, same goes for children function, where as parent functions will give color red to only an element thats above it and nothing else. Now i understand its not for styling, but from my understanding it gives other elements that are above it or bellow it same color or different color for example? It can give them other styles and perhaps functions?

Ok but can you please explain me this part: “Every HTML element has a parent element from which it inherits properties.” It says that element inherits properties from its parent element (the one above it) so how is that we gave a parent element a color? Isnt it other way around? element gives a property to its parent element? I need a bit more explanation in this one.

This seems pretty complicated to me, im just getting more confused. Is this function important in making websites?

I think i actualy understand. Since you have color green in style you didnt close div of parent so div with child also has green text, but once you used parent function in jquery and set the color to red then both parent and child have red text now. So do we only use background color for parent, parents or child functions? Does it work if you actually closed parent div? So if we have selected in a picture i posted above target 1 or 2 or 3 it will change background color of div well only? It doesnt work if we selected target 3 and used parent function so target 2 will change its color?

And one more thing, this functions only work if elements are nested?

So it basicaly only works for nested elements? What i meant about target 3 and 2 if you look at picture above i posted you will notice button target 1, button target 2, button target 3 so what i wanted to ask is if we use $("#target3’). parent(). css( " color ", " red "); it wont change color of button target 2 above it? Instead it will still change color of left well because they are nested with left well?