Html 强制元素中的单行文本用 CSS 填充宽度
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21199057/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Force single line of text in element to fill width with CSS
提问by Alix P?rry
I have a div
element that holds one line of text. How can I get this text to fill the width 100%?
我有一个div
包含一行文本的元素。我怎样才能让这个文本填充宽度 100%?
text-align:justify
is only working on elements with several lines of text, and has no effect on the div
with single line. Manually adjusting the letter-spacing and word-spacing is ugly and ineffective.
text-align:justify
仅适用于具有多行文本的元素,对div
具有单行的元素没有影响。手动调整字母间距和字间距是丑陋且无效的。
Are there any other alternatives?
还有其他选择吗?