我在标题菜单栏中有一个徽标。徽标出现在标题的左上角。在较小的设备上查看徽标时,汉堡菜单中隐藏了徽标。在较小的设备上查看时,是否有办法在顶部居中显示徽标,如果在相同的较大设备上查看,则意味着左上角
我正在使用引导程序3.3.7
handleChange(e) {
const resultList = this.state.list.slice();
resultList[e.target.id] = e.target.value;
this.setState({
list: resultList,
result: this.doSomething(resultList) // this.doSomething(this.state.list)
});
}
答案 0 :(得分:1)
我更改了图像的位置,因此不能以小分辨率隐藏它,而以小分辨率隐藏中心徽标,我添加了一些仅适用于小分辨率的CSS
@media only screen and (max-width: 768px) {
.navbar-brand {
position: absolute;
left: 50%;
transform: translateX(-50%);
}
}
@media only screen and (max-width: 768px) {
.navbar-brand {
position: absolute;
left: 50%;
transform: translateX(-50%);
}
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<nav class="navbar navbar-default" role="navigation">
<div class="navbar-inner">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" 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>
<img src="" class="navbar-brand" ui-sref="homeIndex" style="cursor:pointer;" alt="Virginia System of Care" height="60" width="140">
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a ui-sref="homeIndex">Home</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div>
</nav>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>