How to align card-container and card to center?

The-robot-war.html:

<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>XXMadGames</title>
  <link href="fire.css" rel="stylesheet" type="text/css"/>
  <link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
  <div class="title">
 <li><a href="index.html"><h1>XXMadGames</h1>
 <h5>The Games by Xtreme Xtra Mad Creators</h5>
  </div>
  <nav class="navbar">
  <ul class="nav-links">
    <input type="checkbox" id="checkbox_toggle"/>
    <label for="checkbox_toggle" class="hamburger">☰</label>
    <div class="menu">
      <li class="nav-dropdown">
        <a href="games.html">Games</a>
        <ul class="dropdown">
          <li><a href="The-robot-war.html">The Robot War</a></li>
          <li><a href="https://website.com/link">Some great game</a></li>
          <li><a href="https://website.com/link">Cool Game 5: The coolness of gaming</a></li>
          <li><a href="https://website.com/link">Fun Game Simulator</a></li>
          <li><a href="https://website.com/link">Yet Another Game</a></li>
        </ul>
      </li>
      <li><a href="team.html">Meet The Team</a></li>
    <li><a href="about.html">About Us</a></li>
      <li><a href="join.html">Join the team</a></li>
<div class="card-container" align=middle>
  <div class="card">
    <img src="robotwar.png" alt="Image">
    <h2 class="title">The robot war</h2>
    <li><a href="https://replit.com/@Stickpion/The-robot-war"><h5 class="title">Check out XXStickpion's game, The robot war</h5>
  </div>

style.css file:

html, body {
  height: 100%;
  width: 100%;
}

.title{
 text-align:center;
}

.title h1{
  margin: 2%;
}

.card{
  margin:center;
  text-align:center;
}

fire.css file:

/*
fire.css
By @hecker40
Copyright 2022, All Rights Reserved
Modified by @TalkingSlug12345
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap');

:root {
  --font-family: 'Inter', sans-serif;
  --background-primary-color: #18181a;
  --background-secondary-color: #292929;
  --foreground-primary-color: #b8b8b8;
  --foreground-secondary-color: white;
  --foreground-tertiary-color: orange;
  --accent-primary-color: orange;
  --accent-secondary-color: #ff4405;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: Inter, sans-serif;
  background-color: var(--background-primary-color);
}

main, form {
	display: flex;
	flex-direction: column;
	gap: 64px;
	margin: 64px auto;
	max-width: 1000px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

li {
  list-style: none;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px;
  background: linear-gradient(90deg, var(--accent-primary-color), var(--accent-secondary-color));
  color: var(--foreground-secondary-color);
  box-shadow: var(--accent-secondary-color) 0px 1px 15px;
}

.nav-links a {
  color: var(--foreground-secondary-color);
}

.logo img {
  border: none;
}

.menu {
  display: flex;
  gap: 1em;
  font-size: 18px;
}

.menu li {
  padding: 5px 14px;
}

.nav-dropdown {
  position: relative; 
}

.dropdown {
  background: linear-gradient(var(--accent-primary-color), var(--accent-secondary-color));
  padding: 1em 0;
  position: absolute;
  display: none;
  top: 35px;
  border-radius: 8px;
  box-shadow: var(--accent-secondary-color) 0px 2px 8px 0px;
}

.dropdown li + li {
  margin-top: 10px;
}

.dropdown li {
  padding: 0.5em 1em;
  width: 8em;
  text-align: center;
}

.dropdown li:hover {
  background-color: var(--background-primary-color);
}

.nav-dropdown:hover .dropdown {
  display: block;
}

.navbar input[type=checkbox] {
  display: none;
}

.hamburger {
  display: none;
  font-size: 24px;
  user-select: none;
}

.hamburger:hover {
  cursor: pointer;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--foreground-tertiary-color);
  text-shadow: 3px 1px 15px var(--accent-secondary-color);
}

p {
  font-size: 18px;
  color: var(--foreground-primary-color);
  line-height: 25px;
  max-width: 80%;
}

b, u, i, s {
  color: var(--foreground-secondary-color);
  font-size: 18px;
}

hr {
  border: 1px solid var(--background-secondary-color);
}

h1 {
	font-size: 45px;
}

h2 {
	font-size: 35px;
}

h3 {
	font-size: 30px;
}

h4 {
	font-size: 25px;
}

h5 {
	font-size: 20px;
}

h6 {
	font-size: 17px;
}

img, iframe {
  border: 1.5px solid var(--background-secondary-color);
  border-radius: 8px;
}

a {
  color: var(--foreground-tertiary-color);
  text-decoration: none;
  font-size: 18px;
  transition: 0.3s;
}

/* a:hover {
  text-shadow: 3px 1px 15px var(--accent-secondary-color);
} */

button {
  font-family: var(--font-family);
  background: linear-gradient(90deg, var(--accent-primary-color), var(--accent-secondary-color));
  color: var(--foreground-secondary-color);
  border: none;
  font-size: 20px;
  min-width: 150px;
  max-width: 300px;
  height: 50px;
  border-radius: 10px;
  padding-right: 15px;
  padding-left: 15px;
  transition: 0.3s;
  cursor: pointer;
}

button:hover {
  box-shadow: 3px 1px 15px var(--accent-secondary-color);
}

.btn-secondary {
  background: var(--background-primary-color);
  color: var(--accent-primary-color);
  font-size: 20px;
  min-width: 150px;
  max-width: 300px;
  height: 50px;
  border: 2px solid var(--accent-primary-color);
  border-radius: 10px;
  padding-right: 15px;
  padding-left: 15px;
  cursor: pointer;
  transition: 0.15s, border 0s;
}

.btn-secondary:hover {
  background: linear-gradient(90deg, var(--accent-primary-color), var(--accent-secondary-color));
  color: var(--foreground-secondary-color);
  box-shadow: 3px 1px 15px var(--accent-secondary-color);
  border: none;
}

.btn-large {
  min-width: 350px;
  height: 70px;
  border-radius: 13px;
}

.btn-small {
  width: 100px;
  height: 40px;
  font-size: 16px;
  border-radius: 10px;
}

button:disabled, .btn-secondary:disabled {
  opacity: 0.3;
  cursor: auto;
}

button:disabled:hover {
  opacity: 0.3;
  box-shadow: none;
}

.btn-secondary:disabled:hover {
  background: var(--background-primary-color);
  color: var(--accent-primary-color);
  border: 2px solid var(--accent-primary-color);
  opacity: 0.7;
}

button:active, .btn-secondary:active {
  transform: scale(1.02);
}

button:disabled:active, .btn-secondary:disabled:active {
  transform: none;
}

.btn-block {
  min-width: 100%;
}

input[type="text"], input[type="url"], input[type="number"], input[type="email"], input[type="password"], inpuy[type="time"], input[type="date"], input[type="datetime-local"], input[type="month"], input[type="week"], input[type="search"], input[type="tel"] {
  font-family: var(--font-family);
  background-color: var(--background-primary-color);
  color: var(--foreground-primary-color);
  border: none;
  outline: 1.5px solid var(--background-secondary-color);
  max-width: 450px;
  height: 50px;
  font-size: 20px;
  border-radius: 10px;
  padding-right: 15px;
  padding-left: 15px;
  transition: 0.15s;
}

textarea {
  font-family: var(--font-family);
  background-color: var(--background-primary-color);
  color: var(--foreground-primary-color);
  border: none;
  outline: 1.5px solid var(--background-secondary-color);
  max-width: 100%;
  height: 200px;
  font-size: 20px;
  border-radius: 10px;
  padding: 10px 15px 0;
  line-height: 30px;
  transition: 0.15s;
}

input[type="text"]:focus, input[type="url"]:focus, input[type="number"]:focus, input[type="email"]:focus, input[type="password"]:focus, input[type="time"]:focus, input[type="date"]:focus, input[type="datetime-local"]:focus, input[type="month"]:focus, input[type="week"]:focus, input[type="search"]:focus, input[type="tel"]:focus, textarea:focus {
  outline: 1.5px solid var(--accent-primary-color);
  box-shadow: 3px 1px 15px var(--accent-secondary-color);
}

input[type="text"]:read-only, input[type="url"]:read-only, input[type="number"]:read-only, input[type="email"]:read-only, input[type="password"]:read-only, input[type="time"]:read-only, input[type="date"]:read-only, input[type="datetime-local"]:read-only, input[type="month"]:read-only, input[type="week"]:read-only, input[type="search"]:read-only, input[type="tel"]:read-only, textarea:read-only {
  opacity: 0.5;
}

input[type="text"]:disabled, input[type="url"]:disabled, input[type="number"]:disabled, input[type="email"]:disabled, input[type="password"]:disabled, input[type="time"]:disabled, input[type="date"]:disabled, input[type="datetime-local"]:disabled, input[type="month"]:disabled, input[type="week"]:disabled, input[type="search"]:disabled, input[type="tel"]:disabled, textarea:disabled {
  opacity: 0.5;
}

input[type="file"] {
  display: none;
}

.file-container {
  position: relative;
}

.file-selector {
  display: inline-block;
  font-family: var(--font-family);
  background: linear-gradient(90deg, var(--accent-primary-color), var(--accent-secondary-color));
  color: var(--foreground-secondary-color);
  border: none;
  font-size: 20px;
  height: 50px;
  border-radius: 10px;
  padding: 13px;
  transition: 0.3s;
  cursor: pointer;
}

.file-selector:hover {
  box-shadow: 3px 1px 15px var(--accent-secondary-color);
}

.file-selector:active {
  transform: scale(1.02);
}

.switch {
  position: relative;
  display: inline-block;
  width: 80px;
  height: 34px;
  margin-bottom: 20px;
}

.switch input[type="checkbox"] { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--background-secondary-color);
  -webkit-transition: .4s;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 23px;
  width: 23px;
  left: 7.5px;
  bottom: 5.5px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
}

input[type="checkbox"]:checked + .slider {
  background-color: var(--accent-primary-color);
}

input[type="checkbox"]:checked + .slider:before {
  transform: translateX(42px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

code {
  background-color: var(--background-secondary-color);
  color: var(--accent-primary-color);
  font-size: 17px;
  padding: 3px;
  border-radius: 5px;
}

.footer {
  background: linear-gradient(90deg, var(--accent-primary-color), var(--accent-secondary-color));
  color: var(--foreground-secondary-color);
  text-align: center;
  font-size: 18px;
  padding: 15px;
  box-shadow: var(--accent-secondary-color) 0px 1px 15px;
}

.footer a, .navbar a {
  color: var(--foreground-secondary-color);
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar:horizontal {
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--background-primary-color);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent-primary-color), var(--accent-secondary-color));
  border-radius: 10px;
}

::selection {
  background-color: var(--accent-primary-color);
  color: var(--foreground-secondary-color);
}

.checkbox-container {
  display: block;
  position: relative;
  padding-left: 35px;
  margin-bottom: -40px;
  font-size: 18px;
  color: var(--foreground-primary-color);
}

.checkbox-container:last-child, .radio-container:last-child {
  margin-bottom: 0;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.checkbox-mark {
  position: absolute;
  top: 0;
  left: 0;
  height: 23px;
  width: 23px;
  background-color: transparent;
  border: 1.5px var(--background-secondary-color) solid;
  border-radius: 5px;
  cursor: pointer;
  transition: 0.3s;
}

.checkbox-container input:checked ~ .checkbox-mark {
  background-color: var(--accent-primary-color);
}

.checkbox-mark:after {
  content: "";
  position: absolute;
  display: none;
}

.checkbox-container input:checked ~ .checkbox-mark:after {
  display: block;
}

.checkbox-container .checkbox-mark:after {
  left: 7px;
  top: 3px;
  width: 5px;
  height: 10px;
  border: solid var(--foreground-secondary-color);
  border-width: 0 2px 2px 0;
  -webkit-transform: rotate(45deg);
  -ms-transform: rotate(45deg);
  transform: rotate(45deg);
}

.checkbox-container input:disabled ~ .checkbox-mark, .radio-container input:disabled ~ .radio-mark {
  opacity: 0.4;
  cursor: auto;
}

.radio-container {
  display: block;
  position: relative;
  padding-left: 35px;
  margin-bottom: -40px;
  font-size: 18px;
  color: var(--foreground-primary-color);
}

.radio-container input {
  position: absolute;
  opacity: 0;
}

.radio-mark {
  position: absolute;
  top: 0;
  left: 0;
  height: 23px;
  width: 23px;
  background-color: transparent;
  border: 1.5px var(--background-secondary-color) solid;
  border-radius: 50%;
  transition: 0.3s;
  cursor: pointer;
}

.radio-container input:checked ~ .radio-mark {
  background-color: var(--accent-primary-color);
}

.radio-mark:after {
  content: "";
  position: absolute;
  display: none;
}

.radio-container input:checked ~ .radio-mark:after {
  display: block;
}

.radio-container .radio-mark:after {
 	top: 5.73px;
	left: 5.73px;
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background-color: var(--foreground-secondary-color);
}

table {
  width: 100%;
  border-collapse: collapse;
  border: 1.5px var(--background-secondary-color) solid;
  color: var(--accent-primary-color);
}

table td, table th {
  border: 1.5px var(--background-secondary-color) solid;
  color: var(--foreground-primary-color);
  padding: 10px;
  text-align: left;
}

table th {
  font-size: 22px;
  color: var(--accent-primary-color);
  text-shadow: 3px 1px 15px var(--accent-secondary-color);
}

@media (max-width: 800px) {
  main {
		max-width: 80%;
	}
  
  .menu { 
    display: none;
    position: absolute;
    background: linear-gradient(90deg, var(--accent-primary-color), var(--accent-secondary-color));
    right: 0;
    left: 0;
    text-align: center;
    padding: 16px 0;
  }
  
  .menu li:hover {
    display: inline-block;
    transition: 0.3s ease;
  }
  
  .menu li + li {
    margin-top: 12px;
  }
  
  input[type=checkbox]:checked ~ .menu {
    display: block;
  }
  
  .hamburger {
    display: block;
  }
  
  .dropdown {
    top: 30px;
  }
  
  .dropdown li:hover {
    background-color: var(--background-primary-color);
  }
}

@media (max-width: 600px) {
  img {
		max-width: none !important;
		width: 100%;
	}
}

.card-container {
  display: flex;
  flex-direction: row;
  justify-content: space-evenly;
  align-items: stretch;
  align-content: space-around;
  flex-wrap: wrap;
  gap: 25px;
}

.card {
  outline: 1.5px var(--background-secondary-color) solid;
  border-radius: 8px;
  flex: 1 0 47%;
  transition: 0.3s;
}

.card img, .card svg {
  width: 100%;
  border: none;
  border-radius: none;
}

.card .title, .card p {
  padding: 15px;
}

.card > a {
  padding: 15px;
}

.card:hover {
  outline: 1.5px var(--accent-primary-color) solid;
  box-shadow: 3px 1px 15px var(--accent-secondary-color);
}

.badge {
  background: linear-gradient(90deg, var(--accent-primary-color), var(--accent-secondary-color));
  color: var(--foreground-secondary-color);
  padding: 2px 7px;
  margin-left: 8px;
  border-radius: 5px;
  font-weight: bold;
}

.alert {
  background: linear-gradient(90deg, var(--accent-primary-color), var(--accent-secondary-color));
  color: var(--foreground-secondary-color);
  font-size: 18px;
  padding: 15px 12.5px;
  border-radius: 10px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px var(--background-primary-color) solid;
  border-radius: 50%;
  border-top: 4px var(--accent-primary-color) solid;
  border-right: 4px var(--accent-primary-color) solid;
  border-bottom: 4px var(--accent-primary-color) solid;
  -webkit-animation: spin 1.5s linear infinite;
  animation: spin 1.5s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  
  100% {
    transform: rotate(360deg);
  }
}

Repl link:
https://xx-mad-games.talkingslug12345.repl.co/The-robot-war.html#

You need to use the center arg :

<center></center>
1 Like

This may currently work in all major browsers, but it’s deprecated because this is the job of CSS, and it could stop working at any time.

Just do a </nav> before your div.card-container, right?

1 Like

Can you add it in the line and share it here?

as @UMARismyname said center tag is really I think only for html4 and not compatible with html5 i think css would be better

1 Like