how to control angle of a servo

I'm working on a project. This project is supposed to detect obstacle and light up as a warning, and a servo is supposed to pull a cardboard to a certain degree, and whenever there is no obstacle, it's supposed to go back to 0.
However, the servo just continuously rotate non stop and it stop when I program it to 90 degree.

This is my coding

#include <Servo.h>

#define trig1 6
#define echo1 7
#define led1 11
#define led2 12
#define led3 13

Servo myservo;

long duration1;
int distance1;

void setup() {
Serial.begin (9600);

myservo.attach(5); //pin servo

pinMode(trig1, OUTPUT);
pinMode(echo1, INPUT);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
}

void loop() {
digitalWrite(trig1, LOW);
delay(2);
digitalWrite(trig1, HIGH);
delay(10);
digitalWrite(trig1, LOW);

duration1 = pulseIn(echo1, HIGH);
distance1 = (duration1 / 2)/29.1;

if (distance1 <= 10) {
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH); //3 led light up

Serial.print(distance1);
Serial.println("cm");

myservo.write(180);
}

else if (distance1 <=15){

digitalWrite(led1, LOW);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH); //2 led light up

Serial.print(distance1);
Serial.println("cm");

myservo.write(120);
}

else if (distance1 <=20){

digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, HIGH); //1 led light up

Serial.print(distance1);
Serial.println("cm");

myservo.write(60);
}

else {
myservo.write(0);

digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW); //no led light up

Serial.println("out of range");
}
}

The components are
-ultrasonic sensor HC-SR04
-continuous servo FS90R
-3 x 5mm LED

If anybody can help figure this thing out, please.

the servo just continuously rotate

Could be you've got a continuous rotation ex-servo there.

Buy a proper servo instead.

however, the servo just continuously rotate non stop and it stop when i program it to 90 degree.

That's because what you have is not a servo, it is a "continuously rotating (not really a) servo". As you have discovered you cannot control its position only its speed and direction.