Большие изображения все еще ломают столбец начальной загрузки с максимальной шириной и высотой - PullRequest
0 голосов
/ 11 января 2019

У меня есть шаблоны начальной загрузки, которые пользователи могут использовать для создания отображений изображений и текста, и я ранее добавил max-width: 100% и height: auto к своему img css, который, как я думал, исправил его для некоторых больших изображений.

Однако, если я добавлю в него огромное изображение, оно все равно разрушит контейнер.

Я пытаюсь сделать так, чтобы пользователь мог перетащить изображение в этот контейнер, и изображение подойдет независимо от того, что.

Что я делаю не так?

img {
      max-width: 100%; 
      height:auto;
      margin:0 auto;
    }
#topLeftContent{
      display:flex;
      justify-content:center;
      align-items:center;
    }
    #bottomLeftContent{
      display:flex;
      justify-content:center;
      align-items:center;
    }
    #rightQtrContent{
      display:flex;
      justify-content:center;
      align-items:center;
    }

<div class="container-fluid my-container d-flex h-100">
   <div class="row middle" id="middle" style="background-image: url();">
    <div class="col-lg-6"  id="leftColumnQtr">
      <div class="row" style="height:50%; padding-bottom: 15px;">
        <div class="col-lg-12" style="height:100%;">
            <div  id="topLeftContent" style=" height: 100%; ">
            </div>
        </div>
      </div>
      <div class="row" style="height:50%; padding-top: 15px;">
        <div class="col-lg-12" style="height:100%;">
            <div id="bottomLeftContent" style=" height: 100%;">
               <img src="https://via.placeholder.com/1500x700">
            </div>
        </div>
      </div>
    </div>
    <div class="col-lg-6" id="rightColumnQtrHalf" >
        <div id="rightQtrContent" style=" height: 100%; ">
        </div>
    </div>
   </div>
</div>

Изображение enter image description here

1 Ответ

0 голосов
/ 11 января 2019

Попробуйте использовать img-fluid для всех изображений в начальной загрузке 4. Используйте можно использовать display:flex для выравнивания столбцов.

.row.middle {
  background-image: url('https://drinknooma.com/wp-content/uploads/2016/12/placeholder-1170x731.jpg');
  background-size: cover;
  background-position: center;
}

.row.eqcol div[class^="col-"] {
    display:flex;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<div class="container-fluid my-container">
   <div class="row eqcol middle" id="middle">
    <div class="col-lg-6" id="leftColumnQtr">
      <div class="row">
        <div class="col-lg-12">
            <div id="topLeftContent">
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
				
            </div>
        </div>
        <div class="col-lg-12">
            <div id="bottomLeftContent">
               <img class="img-fluid" src="https://via.placeholder.com/1500x700">
            </div>
        </div>
      </div>
    </div>
    <div class="col-lg-6" id="rightColumnQtrHalf" >
        <div id="rightQtrContent">
        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
        </p>
        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
        </p>
        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
        </p>
        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
        </p>
        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
        </p>
        </div>
    </div>
   </div>
</div>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...