html - CSS - 图像无响应
问题描述
如果您查看www.markallanholley.com
,您会注意到右侧的机器人女孩图像根本没有响应。我已经编写了我认为是处理它的正确方法的代码,但我没有任何运气。我想知道是否有人会看看。
我绝对确定 CSS 正确地定位了 HTML,因为我通过将背景颜色更改为绿色并将背景变为绿色进行了一些测试。然后我删除了那行代码。
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
p {
font-size: 110%;
font-family: 'Work Sans', sans-serif;
}
nav li {
display: inline-block;
list-style: none;
}
footer li {
display: inline-block;
list-style: none;
}
.container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(1fr, 10px, 1fr));
grid-template-rows: 1fr, 80%, 1fr;
grid-row-gap: 5px;
grid-column-gap: 5px;
}
.top {
grid-row: 1 / span 1;
grid-column: 1 / span 3;
}
.leftsection {
grid-row: 2 / span 1;
grid-column: 1 / span 1;
}
.divider {
grid-row: 2 / span 4;
grid-column: 2 / span 1;
}
.rightsection {
grid-row: 2 / span 1;
grid-column: 3 / span 1;
}
.bottom {
grid-row: 3 / span 1;
grid-column: 1 / span 3;
}
.responsive {
max-width: 100%;
height: auto;
}
img:hover {
transform: scale(1.1);
}
/* unvisited link */
a:link {
color: black;
font-weight: bold;
text-decoration: none;
}
/* visited link */
a:visited {
color: gray;
font-weight: bold;
text-decoration: none;
}
/* mouse over link */
a:hover {
color: purple;
font-weight: bold;
text-decoration: none;
}
/* selected link */
a:active {
color: lightpurple;
font-weight: bold;
text-decoration: none;
}
/* Fonts from Google Fonts */
/*
font-family: 'Forum', cursive;
font-family: 'Patua One', cursive;
font-family: 'Work Sans', sans-serif;
*/
<link href="https://fonts.googleapis.com/css2?family=Forum&family=Patua+One&family=Work+Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
<div class="container">
<nav class="top">
<img src="http://www.markallanholley.com/links/topnavbackground.jpg">
<a href="../index.html"><img src="http://www.markallanholley.com/links/mahlogo.png"></a>
<ul>
<li><a href="bio.html">Bio</a></li>
<li><a href="contact.html">Contact</a></li>
<li><a href="community/index.php">Community</a></li>
<li><a href="login.html">Login</a></li>
<li><a href="portfolio.html">Portfolio</a></li>
</ul>
</nav>
<section class="leftsection">
<h1>Hello and Welcome</h1>
<br>
<p>I’m a designer living in Central New York. This website is still being constructed. If you’d like to learn more about me and the type of work that I do, please select <a href="bio.html">Bio</a> or <a href="portfolio.html">Portfolio</a> from the links.
If you’ve hired me and if you want to view a work in progress, please log in using the <a href="login.html">Login</a> link. I have a Contact form for you if you select <a href="contact.html">Contact</a>, or you can email me anytime at:</p>
<br>
<address>
<a href="mailto:markallanholley@gmail.com">markallanholley@gmail.com</a>
</address>
<br>
<p>The Community link is just me practicing installing forum software. You’re welcome to register if you’d like, but I don’t anticipate any activity there.</p>
</section>
<div class="divider">
<img src="http://www.markallanholley.com/links/verticaldivider.png" height="966" width="10">
</div>
<section class="rightsection">
<figure>
<img src="http://www.markallanholley.com/links/notarobot.jpg" alt="Sad robot looking at computer." class="responsive">
<figcaption>"Not A Robot" 2019, Blender, Photoshop</figcaption>
</figure>
</section>
<footer class="bottom">
<ul>
<li><a href="bio.html">Bio </a></li>
<li><a href="contact.html">Contact</a></li>
<li><a href="community/index.php">Community</a></li>
<li><a href="login.html">Login</a></li>
<li><a href="portfolio.html">Portfolio </a></li>
<li>• Copyright 2020 Mark Holley</li>
</ul>
</footer>
</div>
解决方案
您的实现grid-template-columns
有错误。你可以通过浏览器快速查看.container
类。
这是一个快速修复,可能不是您想要的,所以请随时调整。
grid-template-columns: 1fr 10px 1fr;
这是通过小调整修复的屏幕共享。
推荐阅读
- aws-codepipeline - 我应该如何在我的 CDK 构建脚本中使用来自 aws ECR 存储库的基于 Windows 的自定义构建工具 docker 映像作为环境
- javascript - 如果所有子复选框都未选中,如何取消选中父复选框,反之亦然?
- youtube - 为什么嵌入的 Youtube 视频在上周工作时显示视频不可用?没有代码更改和 Youtube Data V3 API
- python - 如何知道会话是否已结束并使用 pcap 数据开始新会话
- mysql - 如何在 IF 语句中使用 INSERT INTO SELECT ON DUPLICATE KEY UPDATE
- laravel - Laravel websocket - 使用 laravel 作为后端开发移动聊天应用程序
- python-3.x - PyCharm Django docker-compose 未解析的参考模型
- javascript - 在javascript中编辑innerhtml后如何更新页面
- angular - 如何触发页面刷新以更新 UI 中同级组件中的值更改
- android - 从 firebase 数据库中检索多个纬度经度