html - 我需要将图像和文本以相同形式保持在中心的解决方案

标签 html css twitter-bootstrap

图片和文字应该居中。文本位于中心,但图像位于文本顶部。我想要文本和图像以相同的方式但只在中心。提前致谢

.

下面是我的代码:

<nav class="navbar navbar-default  navbar-fixed-top">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->


    <div class='col-md-12-fluid' style="
    	
        padding-bottom: 2px;
        background-color:#7E8F7C;
       
        ">
      <div class "row" style="background-color:red !important">
        <div class='col-md-8-fluid'>
          <!--recently search was here-->
          <a class="navbar-brand" href="index.html"></a>
        </div>
        <div class='col-md-4-fluid' style="background-color:#3B3738; height:25px;">
          <h3>Nepal Safety</h3>
        </div>
      </div>


      <div class="row">
        <div class='col-md-8-fluid'>
          <!--recently search was here-->
          <a class="navbar-brand" href="index.html">
            <img src="images/iccn.png" height="50px" width="100px">
          </a>
        </div>
        <br>
        <div class='col-md-4-fluid'>
          <h3>Nepal Safety</h3>
        </div>
      </div>
    </div>

    <div class='clearfix'></div>
    <div class="navbar-header">

最佳答案

这里是:

<nav class="navbar navbar-default  navbar-fixed-top">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->


    <div class='col-md-12-fluid' style="padding-bottom: 2px; background-color:#7E8F7C; min-height: 500px;">
      <div class="row" style="background-color:red !important">
        <div class='col-md-8-fluid'>
          <!--recently search was here-->
          <a class="navbar-brand" href="index.html"></a>
        </div>
        <div class='col-md-4-fluid' style="background-color:#3B3738; height:25px;">
          <h3>Nepal Safety</h3>
        </div>
      </div>


      <div class="row" style="clear: both">
        <div class='col-md-8-fluid' style="width: 500px; margin: 0 auto; background: blue">
          <!--recently search was here-->
          <a class="navbar-brand" href="index.html" style="float: left">
            <img src="images/iccn.png" height="50px" width="100px">
          </a>
          
          <h3>Nepal Safety</h3>
        </div>
      </div>
    </div>

    <div class='clearfix'></div>
    <div class="navbar-header">

关于html - 我需要将图像和文本以相同形式保持在中心的解决方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37021486/

相关文章:

html - 在 twitter-bootstrap 中更改事件 "nav-pills"颜色

java - 使用 xpath 轴在 Selenium 中遍历 DOM

html - 在 div 内的两个 div 上将文本对齐到底部

javascript - 使用子 div 清空和重新填充 div

html - 如何在HTML div中显示css样式?

javascript - Angular 2 - 无法以表格列格式显示数据行

html - "Táco"比 "Taco"宽。我该如何解决?

html - Angular Nested *ngFor 在 HTML 模板中使用时给出无限结果

php - 如何在 PHP imagecolorallocate() 中使用背景图像而不是颜色

javascript - 如何在 Bootstrap 中将 div 文本更改为工具提示?