Lí 离/離 ‘from’ is a preposition used to express distance from something or someone in either place or time.

Structure
Basic form
Lí 离/離 is placed between the two places you want to tell the distance between. The distance is often expressed with the adjectives yuǎn 远/遠 ‘far’ and jìn 近 ‘near’. The adverb hěn 很 is placed before yuǎn 远/遠 and jìn 近.
Negation
A sentence with lí 离/離 is negated with bù 不, which is placed in front of the word expressing the distance.
Question
There are two ways to form a yes-no question. One way is to add the question particle ma 吗/嗎 at the end of the sentence.
If the word expressing distance is an adjective, such as yuǎn 远/遠 and jìn 近, a yes-no question can also be formed by reduplicating the adjective and inserting bù 不 in between. Li 离/離 remains unchanged.
You can also ask questions using interrogative expressions such as duō yuǎn 多远/多遠 ‘how far’, jǐ gōnglǐ 几公里/幾公里 ‘how many kilometers’ or duōjiǔ 多久 ‘how long’. The verb yǒu 有 can precede the interrogative expressions.
With adverbs
Adverbs are not placed directly before lí 离/離 but before the adjective or verb used to describe the distance.
If the predicate of the sentence is an adjective, there must always be an adverb before the adjective, otherwise it will have a comparative meaning. Hěn 很 can be used as a marker – without emphasis, it does not mean ‘very’.
If you want to modify the extent of the distance, adverbs such as tài 太 ‘too, very’ or yǒudiǎn(r) 有点(儿)/有點(兒) ‘a little’ can be placed before yuǎn 远/遠 and jìn 近.
Functions
1. Lí 离/離 expressing ‘near’ and ‘far’
Lí 离/離 is often used with either yuǎn 远/遠 ‘far’ or jìn 近 ‘near’ to indicate a relative distance.
If the first place is known in the context, it can be omitted.
2. Lí 离/離 expressing specific distance
When talking about a specific distance the verb yǒu 有 can be used before a numerical phrase. If there are no other adverbs preceding it, yǒu 有 can be omitted.
If there are adverbs such as zhǐ 只 ’only’ or hái 还/還 ’still’ in the sentence, yǒu 有 is usually required.
When asking about a specific distance, yǒu duō yuǎn 有多远/有多遠 ‘How far’ is often used. Yǒu 有 can be left out of the sentence. The omission of yǒu 有 may imply that the distance talked about is short.
3. Lí 离/離 expressing distance in time
Lí 离/離 can also be used to talk about duration between two moments. When talking about unspecified time yuǎn 远/遠 ‘far’ or jìn 近 ‘near’ can be used.
When asking about a specific duration (yǒu) duōjiǔ (有)多久 ‘how long’ is often used.
When discussing a specific duration, a separable verb denoting the action can be inserted before the time duration.
Adverbs like zhǐ 只 and hái 还/還 are also often used when talking about specific time. The verb yǒu 有 is then required after the adverb.
The moment in time preceding lí 离/離 is often omitted from the sentence, especially when the time is understood as ‘now’.
Also check cóng 从/從
Also check cóng 从/從 v.s. lí 离/離