By the first half of the 18th century, despite rising prosperity evidenced by its growing importance as a banking centre, Edinburgh was described as one of Europe's most densely populated, overcrowded and unsanitary towns.Visitors were struck by the fact that the various social classes shared the same urban space, even inhabiting the same tenement buildings; although here a form of social segregation did prevail, whereby shopkeepers and tradesmen tended to occupy the cheaper-to-rent cellars and garrets, while the more well-to-do professional classes occupied the more expensive middle storeys.but relative economic stagnation during the two world wars and beyond saw the Old Town deteriorate further before major slum clearance in the 1960s and 1970s began to reverse the process.University building developments which transformed the George Square and Potterrow areas proved highly controversial.Historically part of the county of Midlothian, the city has long been a centre of education, particularly in the fields of medicine, Scots law, literature, the sciences and engineering.

By 1821, Edinburgh had been overtaken by Glasgow as Scotland's largest city.

In the 17th century, Edinburgh's boundaries were still defined by the city's defensive town walls.

As a result, the city's growing population was accommodated by increasing the height of the houses.

Buildings of 11 storeys or more were common, Most of these old structures were replaced by the predominantly Victorian buildings seen in today's Old Town.

Following the Treaty of Union in 1706, the Parliaments of England and Scotland passed Acts of Union in 17 respectively, uniting the two kingdoms in the Kingdom of Great Britain effective from .