HTML 边框内右对齐内容:CSS 绝对定位实现
这是一段文本
.container {
position: relative;
border: 1px solid #000;
width: 200px;
height: 100px;
}
.text {
position: absolute;
right: 0;
}
通过设置父元素为相对定位,子元素为绝对定位,并使用 right: 0; 属性,就可以将文本内容在边框内右对齐。
原文地址: https://www.cveoy.top/t/topic/orTB 著作权归作者所有。请勿转载和采集!