gpt4 book ai didi

css - 将文本添加到 Bootstrap 折叠的字形图标链接

转载 作者:行者123 更新时间:2023-11-28 18:01:07 25 4
gpt4 key购买 nike

我有一个像这样的基本页面:

<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.2/js/bootstrap.min.js"></script>
<style>
body { padding-top: 70px; }
</style>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Brand</a>
</div>

<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li><a href="#"><span class="glyphicon glyphicon-envelope"></span></a></li>
<li><a href="#"><span class="glyphicon glyphicon-off"></span></a></li>
</ul>
</div><!-- /.navbar-collapse -->
</nav>
<div class="container">
<div class="col-md-3">Sidebar</div>
<div class="col-md-9">Content</div>
</div>
</body>
</html>

当在小屏幕上查看时,正如预期的那样,导航栏内容折叠成一个带有下拉菜单的右对齐按钮。然而,有些尴尬的是,当我的信封图标和关闭图标折叠到小屏幕下拉菜单中时,它们看起来有些尴尬。然而,它们看起来不错,作为全尺寸导航栏上没有文本的简单图标。有没有办法将文本应用于这些图标链接,以便它显示在折叠菜单中而不是完整的导航栏中?谢谢。

最佳答案

例如:

<span class="icon-bar">
<span class="visible-phone hidden-tablet hidden-desktop">myIconLabel</span>
</span>

visible-phone hidden-tablet hidden-desktop 类将在手机(折叠菜单)上显示,但不会在平板电脑或台式机上显示。

关于css - 将文本添加到 Bootstrap 折叠的字形图标链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20387258/

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