【css常用布局】带图片的名片介绍布局(小白向)

效果展示

在这里插入图片描述

实现原理

布局分析:
在这里插入图片描述
这个布局可以根据实际业务需求进行调整。

html部分:

<div class="container">
  <!-- Image -->
  <div class="container_image"></div>

  <!-- Right side -->
  <div class="container_feature">
    <p class="title">标题</p>
    <div class="content">
      <p>门类1:</p>
      <p>阿巴阿巴</p>
    </div>
    <div class="content">
      <p>门类2:</p>
      <p>阿巴阿巴</p>
      <p>门类3:</p>
      <p>阿巴阿巴</p>
    </div>
  </div>
</div>

css部分:

* {
  box-sizing: border-box;
  margin: 0;
}
/* 外容器 */
.container {
  display: flex;
  margin: 16px 0;
}

/* 左边图片 */
.container_image {
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 9999px;
  height: 95px;
  width: 95px;
  margin: 0 16px;
}

/* 右边内容 */
.container_feature {
  flex: 1;
}
.container_feature .title {
  font-size: 24px;
  line-height: 24px;
  font-weight: bold;
}
.container_feature .content p {
  display: inline-block;
  line-height: 16px;
  margin-top: 15px;
}
.container_feature .content p:nth-child(2n-1) {
  color: rgb(99, 102, 101);
}
.container_feature .content p:nth-child(2n) {
  margin-right: 20px;
}

要学会灵活运用选择器代替类名,让代码更简洁一些。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值