MUI:在彈性框中對齊和調整影像中心
P粉550323338
P粉550323338 2023-09-08 18:20:02

為什麼我的圖像居中對齊,但不兩端對齊?我很困惑..

<Box
      sx={{
        display: 'flex',
        minHeight: '100vh',
        alignItems: 'center',
        flexGrow: 1,
      }}>
      <Container maxWidth="sm">
        <img src="https://static.vecteezy.com/system/resources/previews/001/200/294/original/house-png.png"
          width={200}
          alt="img"
        />
        <LinearProgress sx={{ mt: 4 }} />
      </Container>
    </Box>
P粉550323338
P粉550323338

全部回覆(2)
P粉548512637

如果您想讓內容居中對齊,則必須使用「justifyContent: 'center'」屬性。另外,「Container」元素存在一些問題,您可以使用 。

檢查這是否是您想要實現的目標


  
    img
    
  

Codesandbox 上的示範

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!