【问题标题】:Content of horizontal scroll div is cut水平滚动div的内容被剪切
【发布时间】:2019-03-11 21:10:54
【问题描述】:

我正在使用 javascript 插入我的 HTML。我的代码被截断/截断。

这是我的代码:

function feedbackDiv(feedback_id, feedback_title, feedback_content, feedback_author) {
  return querySnapshot.forEach(function(doc) {
    const data = doc.data();
    var feedback_title = data.title;
    var feedback_content = data.content;
    var feedback_author = data.author;

    document.getElementById("küchen_feedback_p").insertAdjacentHTML('beforeend', feedbackDiv(doc.id, feedback_title, feedback_content, feedback_author));
  });
};
.küchen_co {
  padding: 20px;
}

.küchen_feedback_p {
  overflow-x: auto;
}

.feedback_container {
  padding: 12px 20px;
  margin: 8px 0;
  display: inline-block;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  background-color: #212121;
  color: #ffffff;
  text-align: center;
}

.feedback_container:hover {
  border: 1px solid #7ef6a9;
  animation: color_change 1s;
  background-color: #7ef6a9;
  color: #212121;
}
<div class="küchen_co center">

  <div class="küchen_feedback_p center" id="küchen_feedback_p" style="display: none;">

  </div>

  <div class="noDataContainer_kfeedback_p" id="noDataContainer_kfeedback_p" style="text-align:center;">
    <img src="./broken_heart.png" width="80px" height="auto" />
    <p class="nothing_found_k küchenH">Es wurden derzeit keine Feedbacks abgesendet.</p>
  </div>
</div>

<div class="feedback_container" id="feedbackDiv" style="width:300px; height: 250px; margin-right: 20px;">
  <p id="feedback_id" style="display: none;">${feedback_id}</p>
  <h1 class="" style="word-wrap: break-word;">${feedback_title}</h1>
  <p class="" style="word-wrap: break-word;">${feedback_content}</p>
  <p class="" id="feedback_author" style="display: none;">${feedback_author}</p>
</div>

但是滚动div的内容被剪掉了:https://www.dropbox.com/s/8f95tjojkbpku35/scroll.PNG?dl=0
~菲利普

【问题讨论】:

  • 从您的图像中,结果看起来并不“被截断”,您只需进一步滚动即可查看其余部分。您可以使容器更小(和/或您的字体大小)。顺便说一句,如果您提供显示滚动问题的示例代码会更有帮助;您在一个单独的框中的“占位符”js 文本不是很有帮助

标签: javascript html css scroll horizontal-scrolling


【解决方案1】:

对于所有有其他问题的人。问题可能是以下代码行:

justify-content: center;
  align-items:center;
  text-align:center;

【讨论】:

    猜你喜欢
    • 2011-12-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-02
    • 2012-04-08
    • 2016-12-28
    • 2015-10-30
    相关资源
    最近更新 更多