问题描述
我正在尝试将图像拟合到网格单元上,但没有运气,这是我的JSfiddle:https://jsfiddle.net/RomelF/njax3ufw/1/
这是我的html:
.project-tile {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: 1fr 1fr;
}
#p1 {
background-color: grey;
grid-column: 1 / 2;
grid-row: 1 / 2;
margin: 100px;
}
#p1 img {
object-fit: fill;
max-width: 100%;
max-height: 100%;
}
<div class="nav">
<nav id="navbar">
<h3><a href="#">Click here for contact info</a></h3>
</nav>
</div>
<div class="container">
<section id="welcome-section">
<h1 id="name">My name's Romel,here are some of my projects:</h1>
</section>
<section id="projects">
<div class="project-tile" id="p1"><img src="https://i.imgur.com/tz4vopS.png" alt="Tribute Page"></div>
<div class="project-tile" id="p2"></div>
<div class="project-tile" id="p3"></div>
<div class="project-tile" id="p4"></div>
</section>
</div>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)