Html li ul li 太长,换行但没有缩进
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1867358/
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
li ul li is too long, line wraps but no indention
提问by danielreiser
I've an unordered HTML list (ul
). If the second word is too long the line wraps automatically but the overflowing text isn't indented.
Any ideas how to solve that?
我有一个无序列表的 HTML 列表 ( ul
)。如果第二个单词太长,该行会自动换行,但不会缩进溢出的文本。任何想法如何解决这个问题?
Here is the example: http://tinyurl.com/yk32ek6Then "Leistungen" and then click on KINDERZAHNHEILKUNDE. Now you see what I mean.
示例如下:http: //tinyurl.com/yk32ek6 然后是“Leistungen”,然后单击 KINDERZANHHEILKUNDE。现在你明白我的意思了。
Probably it's because of the css, don't know about that.
可能是因为css,不知道。
回答by Gausie
Replace your indent with padding
用填充替换缩进
padding-left: 2em;
text-indent: -2em;
Should do the trick
应该做的伎俩
回答by nickf
add this CSS:
添加这个CSS:
ul {
list-style-position: outside;
}
Example here: http://jsbin.com/emeda/
这里的例子:http: //jsbin.com/emeda/
回答by Irfan
For my ordered list and the multi line indent I have followed below css
对于我的有序列表和多行缩进,我遵循了下面的 css
.surveyorderedlist{
ol{
list-style-position: outside;
}
li{
margin-bottom:5px;
margin-left:40px;
padding-left:8px;
}
}
and then your html should be
然后你的 html 应该是
<div class="surveyorderedlist">
<span><b>Conditions imposed</b></span>
<ol>
<li>Names and addresses are accessed only by the Financial Service Provider on its own behalf, and solely for its own use;</li>
<li>Names and addresses may only be accessed for a specified purpose;</li>
<li>The fees charged for the provision of the names and addresses from the Motor Vehicle Register (MVR) are duly paid;</li>
<li>Any instances of unauthorised access must immediately be notified to the Secretary for Transport and the Privacy Commissioner; </li>
</ol>
</div>
回答by Sarfraz
This is happening because the word Prophylaxe in der Schwangerschaftis too long to fit in that side bar. You need to increase the width of the sidebar containing your list.
发生这种情况是因为der Schwangerschaft 中的 Prophylaxe一词太长而无法放入该侧栏。您需要增加包含列表的侧边栏的宽度。
The only other solution is to decrease the font size so that even words like above are shown as per width of the sidebar.
唯一的其他解决方案是减小字体大小,以便根据侧边栏的宽度显示上述单词。
EDITPlease let me know if my answers is correct or not as i have some belief of that reason even though someone has -ve marked me; so please let me know if i am wrong by trying it out. thanks
编辑请让我知道我的答案是否正确,因为即使有人标记了我,我也相信这个原因;所以请让我知道我是否错了,请尝试一下。谢谢