我有以下html:
<div class="footer">
<div class="text">
This text float to right
</div>
</div>
和以下CSS:
.footer {
position: fixed;
top: 0;
left:0;
background-color: pink;
width: 100%;
margin-left: 50px;
}
.text {
float: right;
}
这是jsfiddle示例:https ://jsfiddle.net/mddc/68tgqxpa/4/
问题是“某些文本向右浮动”被推到了浏览器边缘之外。如何使用CSS将全文显示到浏览器边缘?
左边距不能删除。
谢谢!
使用这样的宽度footer
:
width: calc(100% - 50px);
然后你就走了!让我知道您的反馈。谢谢!
.footer {
position: fixed;
top: 0;
left: 0;
background-color: pink;
width: calc(100% - 50px);
margin-left: 50px;
}
.text {
float: right;
}
<div class="footer">
<div class="text">
This text float to right
</div>
</div>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句