html - 如果文本很长,则将内容向下推

标签 html css

<分区>

当文本较长时,它会将下一行推到右边并留下空隙,相反我希望它只是将内容向下推并使内容保持在行内

在图像中,您可以看到我所说的将内容向右移动的意思。

这是代码现在的样子,任何帮助都会很棒

HTML

<?php 
        while($row = mysqli_fetch_assoc($newlyAddedVideos))
        {
            $ImageURL = $row['youtubethumbnail'];
            $newlyAddedSongName = $row['songname'];
    ?>

      <div class="column newvideos">
        <div class="card">
        <a href="">
          <img src="<?php echo $ImageURL; ?>" alt="John" style="width:170px; height:100px;">
          <div class="person-container">
            <!--<h2>John Doe</h2>-->
            <p class="title new-video-title"><?php echo $newlyAddedSongName; ?></p>
            <!--<p>Some text that describes me lorem ipsum ipsum lorem.</p>
            <p>example@example.com</p>
            <p><button class="button">Contact</button></p>-->
          </div>
        </a>
        </div>
      </div>
     <?php } ?> 

    </div>

CSS

.person-videos-text{
    padding-top:20PX;
}
.links{
    padding-top:10px;
    padding-left: 230px;
}
   .column {
  float: left;
  width: 130px;
  margin-bottom: 16px;
  //padding: 0 8px;
  word-wrap: break-word;

}

.normal{
    margin-right:10px;
}

.trending{
    margin-right:123px;
}

.newvideos{
    margin-right:58.3px;
}

/* Display the columns below each other instead of side by side on small screens */
@media screen and (max-width: 650px) {
  .column {
    width: 100%;
    display: block;
  }
}

.trending-image-size{
    width:230px; 
    height:120px;
}

/* Add some shadows to create a card effect */
.card {
  //box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
}

/* Some left and right padding inside the container */
.person-container {
  //padding: 0 16px;

}

/* Clear floats */
.person-container::after, .row::after {
  content: "";
  clear: both;
  display: table;

}

.row{

}

.person-name{
    font-size:21px;
    text-decoration: none;
    padding-top:5px;
}

.title {
  color: grey;
  padding-top: 85px;

}

.main-heading{
    padding-top:30px;
}

.trending-title{
    width:230px;
    padding-top: 130px;
}

.new-video-title{
    width:170px;
    padding-top: 110px;
}

Pushed Test

最佳答案

请试试这个 css

    <style>
    .row {
      display: flex;
      flex-wrap: wrap;
    }
.column {
 display: flex;
flex-direction: column;
}
    </style>

关于html - 如果文本很长,则将内容向下推,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53943962/

上一篇:css - 按百分比填充圆形边框

下一篇:html - 如何将表格 TR 精确设置为图像

相关文章:

javascript - 迭代 JS 对象没有给出正确的数据以及 Bootstrap 弹出窗口所需的时间?

javascript - jquery 动画使 ipad 挂起

javascript - 如何在不使用 &lt;input&gt; 的情况下制作带有闪烁光标和可编辑文本的 div?

javascript - 拖放 : get target attributes (ID, 内部 HTML)

html - 需要帮助解决未知问题?

javascript - 如何在 setInterval 方法中更新 HighChart 系列

javascript - 控制 Javascript 选择器

Jquery点击不识别点击

javascript - jQuery 下拉 Bootstrap 不适用于某些情况

css - 如何强制 Electron 基于新的 css 更新渲染?