How to Achieve Absolute Positioning in Angular
14:20 07 Sep 2026

I've been working on an Angular app for a while and need to place an element in the corner of another one. I was planning to us CSS positioning as follows:

Profile Pic
a
.extra-large-avatar {
  width: 256px;
  height: 256px;
  aspect-ratio: 1 / 1;      /* Guarantees a strict square base */
  object-fit: cover;        /* Crops out excess image, centers the content */
  object-position: center;  /* Ensures the face stays centered */
  border-radius: 50%;       /* Creates a perfect circle */
  border-style: solid;
  border-color: var(--medium);
  border-width: 8px;
}
profile-pic-container {
    position: relative;
}
.profile-pic-changer {
    position: absolute;
    top: 50px;
    right: 50px; 
    background-color: var(--light);
}

However, the profile-pic-changer seems to use the page as a whole as the parent for it's positioning. I've found that the way Angular renders, interferes with this but the only work around I found is to include the following which has had no effect:

:host {
  display: block;
  position: relative;
}

Does anyone know what the best practice way of achieving absolute positioning is in Angular?

best-practices html css angular position