简体   繁体   English

菜单文本长时间休息-适合下一行

[英]Menu text long break - fit next line

I have a menu and there is a item where the text is to long and break. 我有一个菜单,并且有一个项目在其中文本要长和中断。 How can the second line fit with the above? 第二行如何与以上相符?

<ul class="sidr-class-sub-menu" style="display: block;">
    <li id="sidr-id-menu-item-14176" class="sidr-class-menu-item sidr-class-menu-item-type-post_type sidr-class-menu-item-object-page sidr-class-menu-item-14176"><a href="https://wave-akademie.de/fb-medien/">FB MEDIEN ÜBERSICHT</a></li>
    <li id="sidr-id-menu-item-14146" class="sidr-class-menu-item sidr-class-menu-item-type-post_type sidr-class-menu-item-object-page sidr-class-menu-item-14146"><a href="https://wave-akademie.de/ausbildung/musik-und-medienmanagement/">MUSIK- UND MEDIENMANAGEMENT<i class="sidr-class-menu-item-desc">(Staatlich anerkannt)</i></a></li>
</ul>

在此处输入图片说明

If you want the second line and first line to be on the same line, like. 如果您希望第二行和第一行在同一行,例如。

MUSIK-UND MEDIENMANGEMENT MUSIK-UND MEDIENMANGMENT

Somethings you can try? 您可以尝试的东西吗?

  1. Make the container wider 使容器变宽
  2. Make the text smaller (reduce letter spacing, or font size etc) 缩小文本(减少字母间距或字体大小等)
  3. Add an overflow property (make it an ellipsis, or hide the letters that don't fit) 添加一个溢出属性(将其设置为省略号,或隐藏不适合的字母)
  4. Add a min width to the container so that it can't shrink past a certain width 向容器添加最小宽度,以使其不会收缩到一定宽度

You can add white-space: nowrap; 您可以添加white-space: nowrap; to the li elements. li元素。 That would help prevent them from wrapping. 这将有助于防止它们包装。

If you're looking to prevent the second list item from line-breaking use the following: 如果您要防止第二个列表项断行,请使用以下命令:

 ul { white-space: nowrap; } 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM