How could I make the text and the banner image sit overlapping each other with the text at the front and the banner image at the back? I’ve tried moving the text manually, but that doesn’t remove the extra negative space that it creates. I am trying to get it to look like this: https://rickandmortyapi.com/
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
.top-container{
padding: 200px;
padding-bottom: 0;
}
.showcase {
background-color: rgb(39,43,51);
}
.showcase-inner {
margin: 0;
padding-top: 30px;
padding-bottom: 30px;
}
.footer {
background-color: rgb(32,35,41);
padding-top: 30px;
}
h1{
font-size: 95px;
text-align: center;
font-weight: 1000;
color: rgb(32,35,41);
}
h2{
font-weight: 1000;
font-size: x-larges;
}
main {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 0;
overflow-x: hidden;
}
.image-container{
display: flex;
}
.image-container img{
width: 229.2px;
height: 220px;
border-radius: 25px 0px 0px 25px;
}
/*
article{
padding: 10px;
}
*/
.character-card{
display: flex;
margin: 13.5px;
background-color: rgb(60,62,68);
border-radius: 25px;
box-shadow: 0 0 10px rgba(37, 37, 37, 0.5);
}
.character-info{
display: flex;
flex-direction: column;
padding: 13.5px;
position: relative;
}
.section{
display: flex;
flex-direction: column;
width: 330px;
height: 64.33px;
color: rgb(245,245,245);
}
.greytext{
color: rgb(158,158,158);
padding-top: 5px;
padding-bottom: 10px;
}
.navbar {
background-color: #ffffff;
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
display: flex;
justify-content: space-between;
}
.navbar li {
float: left;
}
.navbar li a {
display: block;
color: #333;
text-align: center;
padding: 14px 16px;
text-decoration: none;
transition: color 0.2s;
}
.content-links{
margin-left: auto;
padding: 10px;
margin-right: 10px;
font-size: 20px;
font-weight: 750;
}
.content-links a:hover{
color: rgb(255,152,0);
}
.homebutton{
margin-right: auto;
}
.homebutton img{
width: 50px;
height: 50px;
}
.status {
display: flex;
align-items: center;
font-weight: 600;
}
.status-dot {
width: 8px;
height: 8px;
border-radius: 50%;
display: inline-block;
margin-right: 5px;
}
.status-dot.grey {
background-color: rgb(158,158,158);
}
.status-dot.red {
background-color: rgb(214,61,46);
}
.status-dot.green {
background-color: rgb(85,204,68);
}
.about-content{
display: flex;
flex-direction: column;
padding: 5px;
padding-bottom: 20px;
margin-left: 500px;
margin-right: 500px;
font-size: 110%;
color: rgb(66,66,66);
}
.abouth2 {
font-size: 35px;
font-weight: 800;
margin-bottom: 30px;
color: rgb(32,35,41);
}
.abouth3 {
font-size: 25px;
font-weight: 800;
margin-top: 10px;
margin-bottom: 10px;
color: rgb(32,35,41);
}
.ablink {
text-decoration-color: rgb(255,152,0);
text-decoration-thickness: 2px;
text-underline-offset: 4px;
color: rgb(66,66,66);
}
.ablink:hover {
text-decoration: none;
color: rgb(255,152,0);
transition: color 0.2s;
}
.footer-info {
display: flex;
justify-content: center;
list-style: none;
padding-top: 40px;
margin: 0;
font-size: 15px;
font-weight: 750;
color: rgb(158, 158, 158);
}
.footer-info li {
margin-right: 20px;
}
.socials {
display: flex;
justify-content: center;
align-items: center;
padding-top: 20px;
padding-bottom: 10;
}
.socials a {
margin: 10px;
}
.socials a:hover svg path {
fill: rgb(255, 152, 0);
}
.sign {
color: rgb(158, 158, 158);
text-align: center;
padding-top: 15px;
padding-bottom: 50px;
}
.footer-link {
color:rgb(255, 255, 255);
font-weight: 700;
text-decoration-color: rgb(255,152,0);
text-decoration-thickness: 2px;
text-underline-offset: 4px;
}
.footer-link:hover {
text-decoration: none;
color: rgb(255,152,0);
transition: color 0.2s;
}
.banner {
display: flex;
justify-content: center;
align-items: center;
z-index: 1;
}
.banner-text {
z-index: 2;
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Rick and Morty API</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css">
</head>
<body>
<ul class="navbar">
<li class="homebutton"><a href="landing.html"><img src="RMAPI-homepagebutton.png" alt="Home"></a></li>
<li class="content-links"><a href="about.html">About</a></li>
</ul>
<div class="top-container">
<h1 class="banner-text">The Rick and Morty API</h1>
<div class="banner">
<svg width="378" height="376" viewBox="0 0 378 376" fill="rgb(245,245,245)">
<path d="M92.2871 10.1699C90.3999 25.8964 84.8432 45.0828 82.1173 45.0828C81.3834 45.0828 76.3509 42.986 71.0038 40.4697C62.4067 36.4856 49.3012 32.5016 44.4784 32.5016C43.2202 32.5016 43.8493 34.3888 46.8898 40.5746C51.5029 49.9057 55.6966 64.4789 55.1724 69.5114L54.8579 72.8664L45.422 73.6004C17.9529 75.6972 5.05709 76.9554 5.05709 77.4796C5.05709 77.899 9.67022 82.8266 15.3318 88.593C25.921 99.2871 33.6795 110.715 33.1552 114.699C32.9455 116.167 27.5985 120.57 16.5899 128.224C7.67819 134.41 0.234278 139.966 0.0245907 140.491C-0.185097 141.015 0.968185 141.749 2.64569 142.168C13.864 144.58 18.6868 146.152 22.6709 148.459C28.1227 151.709 33.7843 156.532 36.6151 160.516L38.712 163.451L26.9694 175.089C17.1141 184.944 15.4366 186.937 16.6948 188.09C17.5335 188.824 23.8241 191.235 30.7438 193.332C37.6635 195.429 43.7445 197.631 44.2687 198.155C44.7929 198.679 43.9541 204.026 41.9621 211.365C40.1798 218.18 39.0265 224.156 39.341 224.68C39.8652 225.624 57.1645 224.785 59.9952 223.737C62.6163 222.793 63.6648 225.309 64.3987 233.592C64.8181 238.415 65.4471 242.504 65.8665 242.713C66.7052 243.238 78.4478 238.205 78.4478 237.366C78.4478 237.052 77.0848 234.85 75.4073 232.439C70.5845 225.414 67.3343 218.18 64.2938 208.115C62.826 202.873 60.6243 195.848 59.5759 192.388C58.4226 188.929 57.2693 184.211 57.0596 181.904C55.5918 170.791 55.3821 166.702 56.4306 166.702C56.9548 166.702 57.479 168.484 57.479 170.581C57.5838 175.299 59.8904 187.88 61.4631 192.388C62.0921 194.066 64.0842 200.252 65.8665 206.018C70.1651 219.543 76.3509 231.705 81.6979 237.052C84.2142 239.568 89.666 243.133 94.9082 245.544L103.715 249.633L103.401 253.512L103.086 257.392L79.7059 265.15L56.3257 273.013L53.2852 282.973C51.6077 288.53 46.8898 304.991 42.696 319.669C38.5023 334.242 34.5182 346.823 33.8891 347.452C33.2601 348.081 31.3729 353.743 29.8002 360.138C28.2276 366.429 26.7598 372.51 26.4452 373.454C25.921 375.236 30.1148 375.341 104.554 375.341C179.098 375.341 183.292 375.236 183.292 373.454C183.292 372.51 178.364 367.058 172.283 361.397C166.202 355.735 161.274 350.493 161.274 349.654C161.274 348.92 165.049 345.041 169.557 341.057C181.09 331.202 181.195 330.573 176.477 318.515C168.509 298.281 151.419 267.037 145.128 261.166C143.136 259.279 142.402 257.496 142.402 254.666C142.402 250.367 143.346 249.319 148.693 247.536C154.145 245.754 159.492 241.665 163.162 236.528C166.097 232.439 167.355 231.705 175.428 229.189C180.356 227.616 184.34 225.938 184.34 225.519C184.34 224.995 182.453 222.269 180.146 219.543C175.638 214.091 174.799 210.212 177.84 209.268C178.783 208.954 182.453 208.429 185.913 208.01C189.372 207.696 192.518 207.171 192.937 206.857C193.881 206.437 188.534 191.55 187.276 191.025C186.856 190.816 186.437 189.872 186.437 188.824C186.437 187.566 187.905 186.622 191.679 185.678C198.179 184.001 213.696 176.557 213.696 175.194C213.696 174.565 211.704 173.097 209.293 171.839C195.873 165.024 184.969 157.161 187.171 155.903C187.59 155.693 191.469 154.435 195.663 153.177C199.857 151.919 206.672 149.298 210.865 147.41C218.1 144.16 232.988 135.353 232.358 134.724C231.939 134.41 203.526 122.248 200.8 121.304C199.542 120.78 199.228 120.151 199.752 119.207C200.171 118.369 207.091 111.659 215.059 104.32C222.923 96.8757 229.423 90.4802 229.423 90.0608C229.423 89.2221 222.922 88.0688 203.736 85.3429C196.816 84.2944 190.735 83.246 190.316 82.8266C189.792 82.4072 194.615 73.181 201.01 62.3821C211.39 44.6635 213.382 40.8891 212.333 40.8891C212.124 40.8891 203.526 43.9296 193.252 47.7039C178.259 53.1558 174.17 54.2043 173.122 53.1558C170.815 50.8493 168.613 33.55 168.613 18.0331V3.04048L160.121 7.54876C150.161 12.8958 136.846 23.2753 130.66 30.5096C128.353 33.3403 125.942 35.6469 125.523 35.6469C124.998 35.6469 121.014 30.8241 116.506 24.848C108.748 14.5733 95.6421 6.4671e-06 94.1743 6.4671e-06C93.7549 6.4671e-06 92.9162 4.61313 92.2871 10.1699ZM95.2228 272.908C91.3435 275.949 71.5281 328.266 73.1007 330.992C73.6249 331.935 78.1332 336.234 83.1657 340.638C88.3031 345.041 92.6017 349.13 92.8114 349.759C93.021 350.388 91.7629 352.695 89.9806 354.896C88.3031 357.098 86.8353 358.251 86.8353 357.517C86.8353 356.888 87.7788 355.001 89.037 353.533L91.2387 350.703L81.1737 341.267C74.1492 334.661 71.1087 331.097 71.1087 329.419C71.1087 326.064 83.0609 293.982 90.3999 277.522C92.1823 273.537 93.6501 271.545 94.9082 271.545C96.5857 271.65 96.5857 271.755 95.2228 272.908Z"></path>
<path d="M270.733 147.306C241.272 152.653 225.021 164.29 203.948 195.429C199.335 202.139 199.02 202.978 199.02 209.478C199.02 214.51 197.972 219.438 195.246 227.93C190.633 242.294 190.842 245.649 197.447 256.867C200.068 261.271 202.165 265.465 202.165 265.989C202.165 266.618 200.802 268.61 199.02 270.497C193.463 276.473 193.568 285.699 199.335 291.885C202.69 295.345 210.553 298.595 212.65 297.232C213.174 296.918 212.44 294.506 211.077 291.78C209.609 289.159 208.456 286.224 208.561 285.28C208.561 284.232 209.085 284.546 209.714 286.224C211.496 290.103 219.779 302.894 223.868 307.926C231.941 317.991 249.345 328.161 265.596 332.46C270.524 333.718 279.226 334.871 286.565 335.186C293.484 335.5 298.202 336.129 297.049 336.549C290.758 338.75 261.821 334.661 248.506 329.629L241.587 327.008L239.804 329.419C233.199 338.121 225.65 357.937 223.763 371.357L223.239 375.341H288.242C349.681 375.341 353.245 375.236 352.721 373.454C352.407 372.51 350.729 366.219 349.052 359.509C345.382 345.041 342.446 337.807 337.728 331.621C335.841 329.105 334.269 326.484 334.269 325.75C334.373 325.121 336.994 322.604 340.245 320.298C346.116 316.104 354.189 307.612 358.592 300.902C360.06 298.7 362.367 296.918 364.464 296.289C366.246 295.764 369.601 293.563 371.907 291.466C379.142 284.546 379.876 275.11 373.48 269.553C371.278 267.666 370.964 266.723 371.593 263.368C372.012 261.271 372.641 259.279 373.061 258.964C373.48 258.65 374.424 255.609 375.158 252.149C376.206 247.117 376.206 243.238 375.158 232.439C374.424 225.1 373.375 219.124 372.851 219.124C372.327 219.124 372.012 216.188 372.117 212.518C372.327 206.752 371.803 204.97 368.028 197.631C362.996 187.67 355.552 176.767 348.003 168.589C343.39 163.556 340.349 161.564 328.502 155.693C320.115 151.604 311.517 148.144 307.324 147.306C298.622 145.418 280.798 145.418 270.733 147.306Z"></path>
<path d="M147.646 261.69C147.646 262.005 149.638 264.94 152.154 268.19C154.67 271.441 158.13 276.578 160.017 279.409C164.945 287.272 176.373 311.805 179.728 321.556C183.397 331.935 183.083 332.669 172.074 342C167.88 345.565 164.421 349.34 164.421 350.178C164.421 351.122 169.138 356.154 174.905 361.606C181.196 367.373 185.389 372.091 185.389 373.349C185.389 375.236 186.228 375.341 200.067 375.341C211.076 375.341 214.746 375.026 214.746 373.978C214.746 369.574 189.059 277.207 186.647 272.804C186.228 271.965 179.518 269.763 171.76 267.771C164.001 265.884 155.928 263.577 153.726 262.634C149.428 260.956 147.646 260.642 147.646 261.69Z"></path>
</svg>
</div>
</div>
<div class="showcase">
<div class="showcase-inner">
<main></main>
</div>
</div>
<div class="footer">
<ul class="footer-info">
<li>CHARACTERS: 826</li>
<li>LOCATIONS: 126</li>
<li>EPISODES: 51</li>
</ul>
<div class="socials">
<a href="https://github.com/afuh/rick-and-morty-api">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" class="social-icon" style="fill: rgb(158, 158, 158);">
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/>
</svg>
</a>
<a href="https://twitter.com/rickandmortyapi">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" class="social-icon" style="fill: rgb(158, 158, 158);">
<path d="M24 4.557c-.883.392-1.832.656-2.828.775 1.017-.609 1.798-1.574 2.165-2.724-.951.564-2.005.974-3.127 1.195-.897-.957-2.178-1.555-3.594-1.555-3.179 0-5.515 2.966-4.797 6.045-4.091-.205-7.719-2.165-10.148-5.144-1.29 2.213-.669 5.108 1.523 6.574-.806-.026-1.566-.247-2.229-.616-.054 2.281 1.581 4.415 3.949 4.89-.693.188-1.452.232-2.224.084.626 1.956 2.444 3.379 4.6 3.419-2.07 1.623-4.678 2.348-7.29 2.04 2.179 1.397 4.768 2.212 7.548 2.212 9.142 0 14.307-7.721 13.995-14.646.962-.695 1.797-1.562 2.457-2.549z"/>
</svg>
</a>
<a href="https://rickandmortyapi.com/support-us/">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" class="social-icon" style="fill: rgb(158, 158, 158);">
<path d="M12 4.419c-2.826-5.695-11.999-4.064-11.999 3.27 0 7.27 9.903 10.938 11.999 15.311 2.096-4.373 12-8.041 12-15.311 0-7.327-9.17-8.972-12-3.27z"/>
</svg>
</a>
</div>
<div class="sign">
<> by <a class="footer-link" href="https://github.com/afuh">Alex Fuhrmann</a> 2023
</div>
</div>
<script src="script.js"></script>
</body>
</html>
2
Answers
;In the link you provide, the image is set as absolute.
So i think you should edit your css to put your image in absolute and center your title in the middle with flexbox. With this type of settings you will be more able to control heights of your differents parts 🙂
This should like this :
To make the text and the banner image sit overlapping each other with the text at the front and the banner image at the back, you can use CSS positioning and z-index. example of how you can achieve this:
for your case bellow is implementation of it