The legality of a romantic relationship between an 18-year-old and a 17-year-old can vary depending on the laws and age of consent in the specific jurisdiction where you live. Laws related to the age of consent and the age difference allowed for consensual relationships can vary significantly from country to country and even from state to state in some places.
In some areas, there may be what is called a "close-in-age exemption" or "Romeo and Juliet law" that allows for certain small age differences between partners to be considered legal even if one partner is below the age of consent. This is often intended to prevent criminal charges in cases where both partners are close in age and engage in a consensual relationship.
It is essential to know and understand the laws in your specific location to ensure you are acting within the legal boundaries of your jurisdiction. If you have concerns or questions about the legality of your relationship, it is best to consult with a legal professional who can provide you with accurate advice based on your local laws and regulations. Remember that laws can change over time, so staying informed is crucial.