gpt4 book ai didi

html - 尝试创建一个漫画书页面

转载 作者:太空宇宙 更新时间:2023-11-04 06:12:18 25 4
gpt4 key购买 nike

我正在尝试为一个元素创建一个漫画书页面。我设法创建了一个可以打开的封面,现在我正在尝试向首页添加单独的 block ,就像漫画书一样。

但是,当我尝试添加这些 block 时,它似乎将我的封面“推”了过来。例如:https://codepen.io/reallynotprogramming/pen/GadVZJ

我试图在我的主 div 容器中嵌套单个 div,但它似乎不起作用。

body {
background-image: url('images/Avenger\ vs\ Justice\ League2-01.jpg');
background-size: contain;
background-position: center;

}

.flex-container {
/* display: flex;
flex-direction: row; */
background-color: white;
height: 820px;
width: 700px;
margin-top:40px;
margin-bottom: 40px;
margin-left: 500px;
box-shadow: 20px 20px;
}

.cover{
background-image: url(https://upload.wikimedia.org/wikipedia/commons/thumb/0/0b/Symbol_from_Marvel%27s_The_Avengers_logo.svg/877px-Symbol_from_Marvel%27s_The_Avengers_logo.svg.png);
width: 700px;
height: 820px;
transform: rotateY(0deg);
background-color: blue;
transform-style: preserve-3d;
transform-origin: left;
transition: all .5s ease-in;
}

.flex-container:hover .cover{
transform: rotateY(-180deg);
}

.page1{
width: 700px;
height: 820px;
margin-top: 75px;
margin-left: 100px;
background-color: green;
}

.flex-container {
/* display: flex;
flex-direction: row; */
background-color: white;
height: 820px;
width: 700px;
margin-top:40px;
margin-bottom: 40px;
margin-left: 500px;
box-shadow: 20px 20px;
}

.cover{
background-image: url(https://upload.wikimedia.org/wikipedia/commons/thumb/0/0b/Symbol_from_Marvel%27s_The_Avengers_logo.svg/877px-Symbol_from_Marvel%27s_The_Avengers_logo.svg.png);
width: 700px;
height: 820px;
transform: rotateY(0deg);
background-color: blue;
transform-style: preserve-3d;
transform-origin: left;
transition: all .5s ease-in;
}

.flex-container:hover .cover{
transform: rotateY(-180deg);
}

.page1{
width: 700px;
height: 820px;
margin-top: 75px;
margin-left: 100px;
background-color: green;
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Avengers vs JL</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<!-- CSS Link -->
<link rel="stylesheet" type="text/css" href="project.css">


<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>
<body>

<!--Comic Book-->
<div class="flex-container">
<div class="cover"></div>
<div class="page1">Test</div>
</div>

<!-- Optional JavaScript -->

<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>

最佳答案

您的问题是 block 元素默认情况下不会“堆叠”。对于网络,事物遵循线性流。如果你想让东西有点堆积起来,你将不得不改变它们的布局。最简单的方法是使用位置“绝对”指令。我 fork 了你的例子并在这里添加了一些东西:

https://codepen.io/anon/pen/yWELQM

您会注意到该页面现在位于下方。具体来说,这是允许这样做的以下 CSS 规则:

.page1{
width: 700px;
height: 820px;
margin-top: 39px;
padding: 2em;
color: white;
background-color: green;
position: absolute;
top: 0;
bottom: 0;
z-index: -1;
}

您可以考虑阅读 HTML 元素布局的工作原理,以更好地理解它的工作原理。

关于html - 尝试创建一个漫画书页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56318858/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com