html - 如何使用 CSS 在 html 标签 <a> 内创建一个换行符?

标签 html css menu html-lists newline

我想知道如何使用 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;              
}

这是我在屏幕上获得的截图:

enter image description here

如果我通过添加标签 <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>

菜单将出现在我的屏幕上,如下所示:

enter image description here

您可以从上面的屏幕截图中注意到,<li> 的内容已更改且未显示全部文本(仅显示“表格中的数字指定第一个 br”)。

所以,我的问题是:

  1. 如何在 html 标签内创建换行符 <a>为了使标签的所有内容(包含在标签 <a> 中)出现?
  2. 如果可以,如何用CSS实现?

最佳答案

您可以使用 <br>标签,它正在工作。

关于html - 如何使用 CSS 在 html 标签 <a> 内创建一个换行符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27900550/

相关文章:

html - Jade 模板引擎 : show and hide a certain block

javascript - 使用 javascript 上传文件后,Excel CSV 内的按钮和单选按钮

html - 在 CSS 无序列表中使自定义元素符号可点击

android - 如何向 Android Activity 添加底部菜单

html - CSS 下拉菜单在 IE8 中未对齐

html - 如何在 http 站点的 iframe 中允许 https 内容?

javascript - 禁止从 HTML 页面拖动图像

javascript - 对象不支持属性或方法 'menu' JQUERY

javascript - insertRule() 不插入规则但没有给出任何错误

css - 少 CSS : driving includes through parameters