簡體   English   中英

在小屏幕上的下一行制作按鈕,但在 Bootstrap 4 中的大屏幕上保持在同一行

[英]Make button on next row on small screens, but keep in same row on larger screen in Bootstrap 4

我覺得這應該很簡單,但我似乎無法理解它:

我想創建一個帶有兩行文本和一個按鈕的粘性底部欄(本質上是一個 cookie 警告欄)。 在桌面上,我希望按鈕出現在句子旁邊,但在移動設備上,我希望它跳到下一行。

實現這一目標的好而簡單的方法是什么?

謝謝!

基本上,您row內使用帶有col的網格系統,並選擇您需要更改內容的大小。 這是使用引導程序的解決方案的鏈接: https : //codepen.io/DohaHelmy/pen/vYEjXzO

以下是沒有引導程序類但具有引導程序網格系統相同功能的解決方案。

 #cookies { background-color: #eee; display: flex; flex-direction: row; justify-content: center; align-items: center; padding: 20px; } p { padding: 20px; } button { color: #fff; background-color: #357832; border: none; height: 30px; padding: 5px 20px; } @media (max-width: 576px) { #cookies { flex-direction: column; } }
 <div id="cookies"> <p>consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ull</p> <button>aciton</button> </div>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM