html - Bootstrap 在导航栏右侧对齐图像

标签 html css twitter-bootstrap

我无法在导航栏右侧对齐图像。

你能告诉我为什么吗?

https://jsfiddle.net/2juzLktc/

<nav class="navbar navbar-inverse navbar-light">
<div class="container-fluid" id="div1">
 <a class="navbar-brand" href="#"><img src="http://www.clker.com/cliparts/T/G/b/7/r/A/red-dot-hi.png" width="150px" height="30px"></a>
    <ul class="nav navbar-nav navbar-right">
    <li><img src="https://cdn.pixabay.com/photo/2017/02/16/10/20/target-2070972_960_720.png" width="10%" id="eye" ></li>
    </ul>
</div>

最佳答案

像这样向您的图像添加 pull-right 类,它将使图像右对齐。

<ul class="nav navbar-nav navbar-right">
    <li><img class="pull-right" src="https://cdn.pixabay.com/photo/2017/02/16/10/20/target-2070972_960_720.png" width="10%" id="eye" ></li>
</ul>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<nav class="navbar navbar-inverse navbar-light">
	<div class="container-fluid" id="div1">
	 <a class="navbar-brand" href="#"><img src="http://www.clker.com/cliparts/T/G/b/7/r/A/red-dot-hi.png" width="150px" height="30px"></a>
		<ul class="nav navbar-nav navbar-right">
		<li><img class="pull-right" src="https://cdn.pixabay.com/photo/2017/02/16/10/20/target-2070972_960_720.png" width="10%" id="eye" ></li>
		</ul>
	</div>
</nav>

关于html - Bootstrap 在导航栏右侧对齐图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46362560/

相关文章:

jquery - Bootstrap Popover 和图像映射

jquery - 单击带有子元素的主选项时下拉菜单出错

Jquery .each 使用。队列?

javascript - Z-index渲染链接不可点击

javascript - 表格宽度不变

css - 如何在 Eclipse Mars 中禁用 css 警告 "Unknown property"?

Javafx 2.0 Applet安全提示时,如何自定义空Applet区域的背景?

javascript - 动画/s 窃听之前它完成

jquery - 如何使用 img 标签在不拉伸(stretch)移动设备的情况下全屏显示 Bootstrap slider 图像?

css - ROR Bootstrap 单选按钮对齐