我遇到的情況是我只能使用內聯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
可根據屏幕尺寸自動調整。使用
auto
value 屬性height
來自動調整 div 內容,因為內容在窄屏幕上會變得更長。您還可以設置 a
max-width
來限制大屏幕上的 div 寬度。
<div style="width: 95%; max-width: 560px; height: auto; min-height: 171px;">
如果需要進一步的幫助,請隨時與我聯系。
- 1 回答
- 0 關注
- 96 瀏覽
添加回答
舉報
0/150
提交
取消