[英]text-wrap in navbar dropdown doesnt work through css, it works through html
I have a dropdown in BS4 navbar.我在 BS4 导航栏中有一个下拉菜单。 The content goes out of the container on mobile device.
内容从移动设备上的容器中取出。 I want to wrap the text through css.
我想通过 css 将文本换行。
Following code works:以下代码有效:
HTML: HTML:
<div class="dropdown-menu" >
{% for department in object.departments.all %}
<a class="dropdown-item text-wrap" href="">
{{ department.name }}</a>
{% endfor %}
</div>
CSS: CSS:
.dropdown-menu {
width: 30vw;
}
But following code doesnt work:但是下面的代码不起作用:
HTML: HTML:
<div class="dropdown-menu" >
{% for department in object.departments.all %}
<a class="dropdown-item" href="">
{{ department.name }}</a>
{% endfor %}
</div>
CSS: CSS:
.dropdown-menu {
width: 30vw;
}
.dropdown-item{
text-wrap:normal;
}
I think you are looking to use the white-space
property or possibly to use word-wrap
or text-overflow
.我认为您正在寻找使用
white-space
属性或者可能使用word-wrap
或text-overflow
。
I've not heard of the text-wrap
property in css.我没听说过 css 中的
text-wrap
属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.