亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

CSS行類別使某些元素超出框架,而它們應(yīng)該是靜態(tài)的並固定在顯示器底部
P粉156415696
P粉156415696 2024-04-03 18:48:12
0
1
618

目前我的頁(yè)面如下所示。添加行類以使兩個(gè)元素彼此相鄰後,底部導(dǎo)覽列被向下推到我必須滾動(dòng)的位置。

在這裡,您可以看到另一個(gè)沒(méi)有行元素的頁(yè)面,其中導(dǎo)航連結(jié)完美地黏在顯示器的底部(植物和房間導(dǎo)航元素不應(yīng)該位於提醒標(biāo)籤中(圖1),因此請(qǐng)忽略此元素圖片2) 該頁(yè)面是可捲動(dòng)的,並且使我的導(dǎo)覽列保持在正確的位置,但元素的輪廓不正確。所有綠色框顯示應(yīng)位於另一個(gè)上方,以及編輯和刪除按鈕。我嘗試使用用於圖 1 的行類別來(lái)修復(fù)此問(wèn)題,但這導(dǎo)致了圖 1 中的問(wèn)題。

在這裡您可以在「提醒」標(biāo)籤中看到我想要實(shí)現(xiàn)的目標(biāo)

我想知道當(dāng)我的 html 中存在行元素時(shí),我當(dāng)前的 css 程式碼有什麼問(wèn)題會(huì)導(dǎo)致此錯(cuò)誤。

如果您知道一種更好的方式來(lái)顯示彼此相鄰的項(xiàng)目,從而可以防止這種行為,我們也歡迎您。

.row {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #bdbdbd;
    font-family: 'Montserrat', sans-serif;
  }

  .CheckButton {
    margin-left: 30px;
    width: 60px;
    height: 80px;
  }

  .ReminderDescription {
    flex-grow: 1;
    font-weight: bold;
    margin-right: 80px;
  }

導(dǎo)致問(wèn)題的html程式碼片段

{% block content %}
  {% for reminderInstance in Reminders %}
  <div class="row">
    <div class="CheckButton">
      <form action="{{ url_for('reminder', Plant_id = reminderInstance.Plant_id) }}">
        <button class="NewButton NewButton1"></button>
      </form>
    </div>
    <div class="ReminderDescription "> Give {{ reminderInstance.Plant_name }} water {{ reminderInstance.TimeSinceWaterNeeded }} days ago </div>
  </div>
  {% endfor %}
{% endblock %}

如果問(wèn)題出在其他地方,我將包含整個(gè) html 頁(yè)面以及導(dǎo)航 css 程式碼。 提醒 HTML

<!DOCTYPE html>
<html>
    <head>
        <title> Reminders </title>
        <meta name="viewport" content="width=devide-width, initial-scale=1.0">
        <meta charset="utf-8">
        <link rel="shortcut icon" href="/assets/favicon.ico">
        <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
        <link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='src/nav.css') }}">
        <link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='src/Collection.css') }}">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
    </head>
    <body>
        <nav class="nav">
          <a href="{{ url_for('collection') }}" class="nav__link">
            <span class="nav__text">Collection</span>
          </a>
          <a href="{{ url_for('index') }}" class="nav__link">
            <span class="nav__text">Home</span>
          </a>
          <a href="{{ url_for('reminders') }}" class="nav__link nav__link--active">
            <span class="nav__text">Reminders</span>
          </a>
        </nav>
    </body>
</html>

{% block content %}
  {% for reminderInstance in Reminders %}
  <div class="row">
    <div class="CheckButton ">
      <form action="{{ url_for('reminder', Plant_id = reminderInstance.Plant_id) }}">
        <button class="NewButton NewButton1"></button>
      </form>
    </div>
    <div class="ReminderDescription "> Give {{ reminderInstance.Plant_name }} water {{ reminderInstance.TimeSinceWaterNeeded }} days ago </div>
  </div>
  {% endfor %}
{% endblock %}

導(dǎo)覽 CSS

body {
    margin: 0 0 55px 0;
}

.nav {
    position: fixed;
    bottom: 0;
    width: 100%;
    height: 55px;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
    background-color: #4ea662;
    display: flex;
    overflow-x: auto;
}

.nav__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    min-width: 50px;
    overflow: hidden;
    white-space: nowrap;
    font-family: 'Montserrat', sans-serif;
    font-weight: bold;
    font-size: 15px;
    color: #ffffff;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.1s ease-in-out;
}

.nav__link:hover {
    background-color: #eeeeee;
}

.nav__link--active {
    padding: 2px 4px;
    border: none;
    text-align: center;
    border-radius:5px;
    background-color: #468454;
    color: #ffffff;
}

P粉156415696
P粉156415696

全部回覆(1)
P粉905144514

將整個(gè)內(nèi)容放入 div 中(如下所示,寬度為 90%)解決了整個(gè)問(wèn)題:

.div-2 {
      margin: auto;
      width: 90%;
      height: 90%;
 }
最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板