How do I align a `position: absolute` `span` by its baseline/cap?
19:40 27 Sep 2026

I want to align a span to the bottom-left- or top-right-hand corner of a div. I could do this:

.container {
    position: relative;
    width: 100px;
    height: 100px;
    border: 1px solid currentColor;
}
.bottom-left {
    position: absolute;
    bottom: 0;
    left: 0;
}
.top-right {
    position: absolute;
    top: 0;
    right: 0;
}

X X

However, the Xes are not fully in the corners in most fonts. The bottom-right X needs to be positioned relative to its baseline, and the top-right X needs to be positioned relative to its cap. How do I do this for a position: absolute element?

html css