第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

粘性元素和媒體查詢的布局問題

粘性元素和媒體查詢的布局問題

瀟湘沐 2024-01-22 15:40:00
首先,我對我糟糕的標題感到抱歉,如果您想到更好的標題,請重命名這個問題。我想在移動設(shè)備上顯示調(diào)整頁面布局。當(dāng)前的桌面版本是:我想做一些類似的事情:文本是粘性的,并在滾動每個步驟時通過 JS 進行自我調(diào)整。因此,我有一個.text-container具有與繪圖的整個高度相匹配的特定高度的元素。我的.text元素就是 的元素sticky。所以我的 HTML 看起來像:<article>    <div class="figure">        <div class="step" id="step-1"></div>        <div class="step" id="step-2"></div>        <div class="step" id="step-2-5"></div>        <div class="step" id="step-3"></div>        <div class="step" id="step-4"></div>    </div>    <div class="text-container">        <div class="text">            <h1>                Step <span>1</span>            </h1>            <div class="bold">Alice’s phone broadcasts a random message every few minutes</div>            <p>                In order to maintain user privacy, the message is sent over Bluetooth and does not use location for proximity detection.                <br>                This message is called a Proximity Identifier or EphID. Theses identifiers are unique and change often.            </p>        </div>    </div></article>這是我用來調(diào)整布局的 CSS(此處的代碼位于 SCSS 中):@media (max-width: 960px) {    article {        .text-container {            .text {                top: 50vh;                left: 0;                width: 100vw;                height: 50vh;                background: grey;            }        }    }}不幸的是,我得到了這個:元素的寬度和位置似乎有問題.text。根據(jù)評論中的要求,這里是一個CodePen,沒有圖像,但它的工作原理相同)
查看完整描述

1 回答

?
慕沐林林

TA貢獻2016條經(jīng)驗 獲得超9個贊

我有一個max-width房產(chǎn),它的布局很混亂。


我發(fā)布我更改的代碼,以防萬一有人遇到與我相同的問題:


@media (max-width: 960px) {

? ? article {

? ? ? ? .text-container {

? ? ? ? ? ? position: absolute;

? ? ? ? ? ? top: 100vh;

? ? ? ? ? ? left: 0;

? ? ? ? ? ? .text {

? ? ? ? ? ? ? ? position: -webkit-sticky;

? ? ? ? ? ? ? ? position: sticky;

? ? ? ? ? ? ? ? top: 50vh;

? ? ? ? ? ? ? ? left: 0;

? ? ? ? ? ? ? ? width: 100vw;

? ? ? ? ? ? ? ? max-width: 100vw;

? ? ? ? ? ? ? ? height: 50vh;

? ? ? ? ? ? ? ? background: grey;

? ? ? ? ? ? }

? ? ? ? }

? ? }

}


查看完整回答
反對 回復(fù) 2024-01-22
  • 1 回答
  • 0 關(guān)注
  • 125 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號