前端学习-UI框架学习-Bootstrap5-007-图像形状
圆角效果rounded
<img src="./img/537.jpeg" class="rounded" alt="圆角效果" height="236">
椭圆rounded-circle
<img src="./img/537.jpeg" class="rounded-circle" alt="拖延" height="236">
缩略图img-thumbnail
<img src="./img/537.jpeg" class="img-thumbnail" alt="圆角效果" height="236">
图片对齐方式
使用 .float-start 类来设置图片左对齐,使用 .float-end 类设置图片右对齐:
<div class="container mt-3">
<h2>对齐</h2>
<p>使用 .float-start 类来设置图片左对齐,使用 .float-end 类设置图片右对齐:</p>
<img src="./img/537.jpeg" class="float-start" alt="圆角效果" height="236">
<img src="./img/5372.jpeg" class="float-end" alt="圆角效果" height="236">
</div>
居中
使用 .mx-auto (margin:auto) 和 .d-block (display:block) 类来设置图片居中对齐:
<template>
<div class="container mt-3">
<h2>居中</h2>
<p>使用 .mx-auto (margin:auto) 和 .d-block (display:block) 类来设置图片居中对齐:</p>
<img src="./img/537.jpeg" class="mx-auto d-block" alt="圆角效果" height="236">
<img src="./img/5372.jpeg" class="float-end" alt="圆角效果" height="236">
</div>
</template>
响应式图片
图像有各种各样的尺寸,我们需要根据屏幕的大小自动适应。
我们可以通过在 标签中添加 .img-fluid 类来设置响应式图片。
.img-fluid 类设置了 max-width: 100%; 、 height: auto; :
<template>
<div class="container mt-3">
<h1>响应式</h1>
<!-- <img src="./img/537.jpeg" class="mx-auto d-block" alt="圆角效果" height="236"> -->
<img src="./img/5372.jpeg" class="img-fluid" alt="圆角效果" height="236">
</div>
</template>
分类:
前端学习 / UI框架学习
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!