<分区>
<分区>
所以我试图将这个绝对定位的红色 div 与完全向右的文本对齐,我正在使用变换和旋转来翻转 div 但在此过程中,div 保持 float 在右边界旁边视口(viewport),我想完全对齐右边框。
我怎么能用 css 解决这个问题?
body{position:relative;}
<div style="padding:15px 125px 15px 15px; background-color:red; display:flex; align-items:center; z-index:999999999999999; position:absolute; right:0px; top:40%; transform: rotate(-90deg); transform-origin:center;">
<i class="fa fa-cutlery" style="color:black; font-size:20px; margin-right:10px;"></i>
<span style="font-size:30px; color:black;">Reservar</span>
</div>
最佳答案
您可以这样调整代码:
<div style="padding:15px 125px 15px 15px; background-color:red; display:flex; align-items:center; z-index:999999999999999; position:absolute; right:0px; top:0; transform:rotate(-90deg) translateY(-100%);transform-origin:top right;">
<i class="fa fa-cutlery" style="color:black; font-size:20px; margin-right:10px;"></i>
<span style="font-size:30px; color:black;">Reservar</span>
</div>
关于html - 旋转的 div 不粘在视口(viewport)的右边界上(向左平坦),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50761598/