亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

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

如何使用內聯 css 使 div 響應式

如何使用內聯 css 使 div 響應式

慕容708150 2023-10-16 10:07:26
我遇到的情況是我只能使用內聯CSS,否則我們的Wordpress 主題會變得一團糟。我構建了這個小 div,它應該是我們文章中的轉換元素。我現在需要讓它響應移動設備。感謝所有幫助:)這就是我的代碼:<div style="width: 560px; height: 171px; padding: 32px 32px 0px 32px; box-shadow: 0 0.063rem 0.188rem rgba(0,0,0,0.2), 0 0.125rem 0.125rem rgba(0,0,0,0.12), 0 0 0.125rem rgba(0,0,0,0.14);">    <div>        <h2 style="font-family: 'Circular TT', Helvetica, sans-serif; font-weight: 700px; margin: 0px; color: #003264;">Ist Ihnen das Preis-Leistungsverh?ltnis für Ihren Zahnschutz wichtig?</h2>    </div>    <div style="margin-top: 32px; display: block; text-align: center;">        <button onclick="window.location.href = ;" type="submit" style="display: inline-block; color: #32ff96; background-color: #003264; border: 0.125rem solid #003264; font-family: Circular TT, Arial, Helvetica, sans-serif; font-weight: 700; font-size: 1rem; cursor: pointer; text-decoration: none; position: relative; width: calc(50% - 15px); padding: .625rem 1.37rem;">Ja</button>        <button onclick="window.location.href = ;" type="submit" style="display: inline-block; color: #32ff96; background-color: #003264; border: 0.125rem solid #003264; font-family: Circular TT, Arial, Helvetica, sans-serif; font-weight: 700; font-size: 1rem; cursor: pointer; text-decoration: none; position: relative; width: calc(50% - 15px); padding: .625rem 1.37rem; margin-left: 20px;">Nein</button>    </div></div>
查看完整描述

1 回答

?
尚方寶劍之說

TA貢獻1788條經驗 獲得超4個贊

要使您的 div 具有響應能力:

  • 使用動態寬度值,例如%或 ,vh可根據屏幕尺寸自動調整。

  • 使用autovalue 屬性height來自動調整 div 內容,因為內容在窄屏幕上會變得更長。

  • 您還可以設置 amax-width來限制大屏幕上的 div 寬度。

<div style="width: 95%; max-width: 560px; height: auto; min-height: 171px;">

如果需要進一步的幫助,請隨時與我聯系。


查看完整回答
反對 回復 2023-10-16
  • 1 回答
  • 0 關注
  • 96 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號