html - 如何进行 HTML/CSS 定位
问题描述
我是 html 和 css 的新手,所以很抱歉提出这个问题,但是您如何管理 html 中的多个项目?似乎很难。我正在尝试对其进行图像和悬停效果,并在此效果下方有一个文本,然后在其下方有一个画廊并将其全部居中。请建议我这样做的方法。我将包含我在下面编写的代码,这是针对 django 网站的,因此某些内容可能与实际的 html/css 不同。
html:
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>hey</title>
<link rel="stylesheet" href="{% static "portofolio/css/cc.css" %}">
</head>
<body>
<div class="card">
<img src="{% static 'portofolio/img/save.png' %}" alt="Card Back">
<img src="{% static 'portofolio/img/try.png' %}" class="img-top" alt="Card Front">
</div>
<div class="text">
<h1>Hello. This is me</h1>
</div>
</body>
</html>
CSS:
body{
background-color: black;
}
.card {
position: relative;
display: inline-block;
}
.card .img-top {
display: none;
position: absolute;
top: 0;
left: 0;
}
.card:hover .img-top {
display: inline;
}
.text{
color: white;
font-family: 'TYPOGRAPH PRO',sans-serif;
margin-left: 500px;
margin-bottom: 500px;
}
解决方案
推荐阅读
- javascript - 为什么 JS 标签在不与循环一起使用时不起作用
- windows - 如何在 Windows 10 Pro 中完全卸载 Minikube?(巧克力)
- reactjs - IBM Cloud Foundry 上的 React App 构建失败
- android - 将 gradle 与 android studio 同步的问题
- java - 对象变量的 L 缓存自动优化?
- python - asyncio:从执行器中的异步函数收集结果
- python - 使用 Python Docker SDK 命名图像并创建容器
- angular - Angular 5:在自定义验证器中调用服务方法
- javascript - 我可以从我的下拉选择变量中删除“null”吗
- css - 图像图像位于顶部/左侧的引导卡,取决于列断点?