【问题标题】:Bootstrap image position in jumbotronjumbotron中的引导图像位置
【发布时间】:2019-11-03 21:38:49
【问题描述】:

似乎我无法使该图像与文本对齐。
我正在尝试使该徽标与这两个句子对齐。

另外,没有样式设置。只是默认的 Bootstrap.css 文件。

<div class="box-padding-md grey-bg">
  <div class="jumbotron jumbotron-fluid">
    <div class="container">
      <img src="../img/bg.png" style="float:left;width:150px;height:150px;margin-left:20px;margin-right:20px;margin-bottom:20px;">
      <h3 class="display-5">"Espher Information Assocation"</h3>
      <p class="lead">제16세대 프로젝트</p>
    </div>
  </div>
</div>

【问题讨论】:

  • “对齐”是什么意思?

标签: css image position


【解决方案1】:

您可以使用引导媒体对象来做到这一点,无需为此使用任何 css。 检查该链接你可以有一个更好的主意 https://getbootstrap.com/docs/4.0/layout/media-object/

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Bootstrap Media</title>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
</head>
<body>
  <div class="box-padding-md grey-bg">
    <div class="jumbotron jumbotron-fluid">
      <div class="container">  
        <div class="media p-3">
          <img src="https://i.imgur.com/v9f1nS2.jpg" alt="John Doe" class="mr-3 mt-3 rounded-circle" style="width:60px;">
           <div class="media-body">
            <h3 class="display-5">"Espher Information Assocation"</h3>
            <p class="lead">제16세대 프로젝트</p>
          </div>
        </div>
      </div>
    </div>
  </div>
</body>
</html>

【讨论】:

  • 像奇迹一样工作。谢谢
【解决方案2】:

你可以使用这样的东西

<style>
.align{
   width:150px;
   height:150px;
   margin-left:20px;
   margin-right:20px;
   margin-bottom:20px;
}
<style>

In HTML use this

<a class="align"><img src="../img/bg.png" alt=""></a>

【讨论】:

  • 谢谢。试过了,结果还是一样。
  • 你可以使用引导类
【解决方案3】:

使用网格系统:https://jsfiddle.net/wwWaldi/3xy4woq7/13/

<div class="box-padding-md grey-bg">
  <div class="jumbotron jumbotron-fluid">
      <div class="row">
        <div class="col-1"></div>
        <div class="col-4 text-right">
           <img src="../img/bg.png" id="myImg" >
        </div>
        <div class="col-6">
          <h3 class="display-5">"Espher Information Assocation"</h3>
          <p class="lead">제16세대 프로젝트</p>    
        </div> 
        <div class="col-1"></div>
    </div>
  </div>
</div>

【讨论】:

  • 谢谢。工作,但是,似乎与手机有点麻烦。我会弄明白的
猜你喜欢
  • 2016-04-21
  • 1970-01-01
  • 1970-01-01
  • 2018-07-21
  • 2021-11-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-12-01
相关资源
最近更新 更多