我想知道如何使用 CSS 在 html 标记内创建换行符。解释如下:
这是我的 HTML 代码:
<ul class="dropdown-menu pull-right" id="mess_menu" role="menu"><li style="border-bottom: 1px #D3D3D3;border-bottom-style: solid;"><span style="display:block; width: 200px">The numbers in the table specify the first browser version that fully supports the property.The numbers in the table specify the first browser version that fully supports the property.</span></li></ul>
这是代码 CSS(它属于菜单):
#mess_menu{
overflow: scroll;
overflow-x: hidden;
height: 360px;
width: 400px;
}
这是我在屏幕上获得的截图:
如果我通过添加标签 <a>
来更改上面的代码 HTML如下(注意我输入了 <a href="" style="display:block;">
):
<ul class="dropdown-menu pull-right" id="mess_menu" role="menu"><li style="border-bottom: 1px #D3D3D3;border-bottom-style: solid;"><a href="" style="display:block;"><span style="display:block; width: 200px">The numbers in the table specify the first browser version that fully supports the property.The numbers in the table specify the first browser version that fully supports the property.</span></a></li></ul>
菜单将出现在我的屏幕上,如下所示:
您可以从上面的屏幕截图中注意到,<li>
的内容已更改且未显示全部文本(仅显示“表格中的数字指定第一个 br”)。
所以,我的问题是:
- 如何在 html 标签内创建换行符
<a>
为了使标签的所有内容(包含在标签<a>
中)出现? - 如果可以,如何用CSS实现?
最佳答案
您可以使用 <br>
标签,它正在工作。
关于html - 如何使用 CSS 在 html 标签 <a> 内创建一个换行符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27900550/