如何填满点线
P粉757640504
P粉757640504 2023-09-15 15:37:13
0
1
452

请帮我解决这个问题 如何在reactjs中的食物名称和价格之间的空白处填写一行点? (图片示例) 我正在为我的项目使用 Material UI 库,在此处输入图像描述

我正在为我的项目使用 Material UI 库

<Grid container spacing={2}>
      {coffeeMenu.map((item, index) => (
        <Grid item xs={6} key={index}>
          <Link
            underline='none'
            sx={{
              display: 'flex',
              flexDirection: 'row',
              justifyContent: 'space-between',
              alignItems: 'center',
              px: 5,
              fontWeight: 'bold',
              color: '#000',
              '&:hover': {
                color: '#D8AE78',
                cursor: 'pointer',
              },
            }}
          >
            <Typography>{item.name}</Typography>
            <Typography>{item.price}đ</Typography>
          </Link>
        </Grid>
      ))}
    </Grid>

P粉757640504
P粉757640504

全部回复(1)
P粉741678385

您可以在食品名称和价格之间添加一个带有虚线边框的 div。我需要查看您的代码来准确地向您展示如何实现,但类似这样的东西可以工作:

.container {
  width: 50%;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.food_name {
  margin-right: 20px;
}

.food_price {
  margin-left: 20px;
}

.dashed_line {
  flex: 1;
  border-top: 1px dashed black;
}
<div class="container">
  <p class="food_name">Hotdog</p>
  <div class="dashed_line"></div>
  <p class="food_price">.99</p>
</div>
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!