问题描述
我有一个网格,其中包含 2 个我使用过的网页的屏幕截图(imgs),并想在我的个人网站(作品集)上发布。我想添加一个叠加层,这样当您将鼠标悬停在图像上时,它会变暗,然后出现描述每个项目是什么的白色文本。您还应该可以选择单击图像,它会直接将您带到我的 github(请注意,我只是使用了常规的 github 网址,因为我不想将自己的网址放入)
这是我的代码:
<section id="work">
<h1 class="work__title">My Work</h1>
<div class="grid">
<div class="grid__item">
<h2 class="grid__item--title">Personal Site</h2>
<div class="grid__item--img">
<a href="https://github.com/"><img src="img/personal.png" alt="proffesional-site" width="768" height="432"></a>
</div>
<p class="grid__item--descr">
My own personal website.<br>
(HTML and CSS)
</p>
</div>
<div class="grid__item">
<h2 class="grid__item--title">Colombia</h2>
<a href="https://github.com/"><img src="img/colo.png" alt="Colombia-site" width="768" height="432"></a>
<p class="grid__item--descr">
Expat service for individuals moving to Colombia. <br>
(HTML and CSS)<br>
</p>
</div>
</div>
</div>
</section>
.grid__item {
display: inline-block;
width: 33%;
}
.grid__item--title {
font-family: var(--main-font);
font-size: 2rem;
}
.grid__item--descr {
font-family: var(--second-font);
font-size: 1.25rem;
}
@supports (display: grid) {
.grid {
display: -ms-grid;
display: grid;
/*grid-template-columns: 300px 300px 300px; fractions are better than pixels - they are responsive */
-ms-grid-columns: 1fr 25px 1fr 25px 1fr;
grid-template-columns: 1fr 1fr 1fr;
grid-gap: 25px;
padding: 0 6rem;
margin: 0;
}
.grid__item {
width: auto;
min-height: auto;
text-align: center;
}
.grid__item a {
color: rgb(8,8,8);
font-size: 1.5rem;
}
.grid__item:last-child {
-ms-grid-column: 3;
grid-column: 3 / 3;
-ms-grid-row: 1;
-ms-grid-row-span: 2;
grid-row: 1 / 3;
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)