簡體   English   中英

無法與 CSS 對齊左、中和右

[英]Unable to align Left, Middle and Right with CSS

在此處輸入圖像描述

無法根據 DIV 對齊左、中和右。 正如我在圖片中發布的那樣,我需要一個簡單的布局。

當我試圖糾正 alignment 時,它變得一團糟。

你能檢查一下並幫助我得到我想要的布局嗎?

我的代碼:

 body { background: #000000 50% 50%; overflow-x: hidden; overflow-y: hidden; }.video { width: 100vw; height: 100vh; display: grid; place-items: center; }.left { text-align: left; position: absolute; }.right { text-align: right; position: absolute; }
 <body> <div class="left"> <p style="color: blue;">Title</p> <img src="https://place-hold.it/336x280" /> <br> <p style="color: blue;">Title</p> <img src="https://place-hold.it/280x500" /> </div> <div class="video"> <img src="https://place-hold.it/500x500" /> </div> <div class="right"> <p style="color: blue;">title</p> <img src="https://place-hold.it/336x280" /> <br> <p style="color: blue;">Title</p> <img src="https://place-hold.it/280x500" /> </div> </body>

像這樣的東西?

 body { background: #000000 50% 50%; }.video { margin: 50px 20px; }.left { text-align: left; }.right { text-align: right; }.container { display: flex; flex-direction: row; justify-content: space-around; }
 <body> <div class="container"> <div class="left"> <p style="color: blue;">Title</p> <img src="https://place-hold.it/336x280" /> <br> <p style="color: blue;">Title</p> <img src="https://place-hold.it/280x500" /> </div> <div class="video"> <img src="https://place-hold.it/500x500" /> </div> <div class="right"> <p style="color: blue;">title</p> <img src="https://place-hold.it/336x280" /> <br> <p style="color: blue;">Title</p> <img src="https://place-hold.it/280x500" /> </div> </div> </body>

暫無
暫無

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

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