gpt4 book ai didi

html - 如何在 Bootstrap 中将长列表句子分成多行

转载 作者:行者123 更新时间:2023-11-28 06:21:24 25 4
gpt4 key购买 nike

我正在建立一个个人网站,而且对 html 还很陌生。我的导航栏看起来像

<!DOCTYPE html>
<html lang="en">

<head>
<title>Bob Mandal | Projects</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script src="MyWebsiteScript.js"></script>
<link rel="stylesheet" href="MyStyleSheet.css" />
</head>

<body>

<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<!---logo-->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#mainNavBar">
<span class="icon-bar"> </span>
<span class="icon-bar"> </span>
<span class="icon-bar"> </span>
</button>
<a class="navbar-brand" style="font-weight: bold">Bob Mandal</a>
</div>

<!--menu Item here-->
<div class="collapse navbar-collapse" id="mainNavBar">
<ul class="nav navbar-nav">
<li>
<a href="#" style="font-weight: bold">About Me</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" style="font-weight: bold">Curriculum Vitae<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
<a href="#" target="_blank" style="font-weight: bold">CV</a>
</li>
<li>
<a href="#" target="_blank" style="font-weight: bold">Resume</a>
</li>
</ul>
</li>
<li class="active dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" style="font-weight: bold">Projects<span class="caret"></span></a>
<ul class="dropdown-menu project-menu">
<li style="text-align: center">
<a href="#Pilot" style="font-weight: bold" class="sidebarlink">Research</a>
</li>
<li style="text-align: center">
<a href="#PIRAT" style="font-weight: bold">Arrrgh</a>
</li>
<li style="text-align: center">
<a href="#SAMPLE" style="font-weight: bold">This is a very long sentence which I need to divide into two line.Is it possible?</a>
</li>
<li style="text-align: center">
<a href="#Quad" style="font-weight: bold">Quad</a>
</li>
</ul>
</li>
</ul>

<ul class="nav navbar-nav navbar-right">
<li>
<a href="#" style="font-weight: bold">Contact</a>
</li>
<li id="linkedIn">
<a href="#" width="22px" />Linked in</a>
</li>
</ul>
</div>
</div>
</nav>
</body>

我向所有专家提出的第一个问题是,如何将下拉菜单中的长句用多个句子包装起来?我不担心大屏幕,但在标准的 Android 手机上它看起来很可怕。

我的第二个问题是在移动设备上,当导航栏是一个类似菜单的下拉菜单时。如何确保导航栏在用户单击菜单项后缩回或关闭或折叠。现在我必须切换屏幕右上角的图标来缩回或折叠下拉菜单。

如有任何帮助,我将不胜感激。

最佳答案

您可以通过在段落标记之间添加第二行来轻松地做到这一点。像这样:http://jsfiddle.net/ycUB6/10706/

  <a href="#SAMPLE" style="font-weight: bold">This is a very long sentence which
<p>I need to divide into two line.Is it possible</p></a>

关于html - 如何在 Bootstrap 中将长列表句子分成多行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35568100/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com