Adding Footer to the back page, centered in the middle

Taking into account everything you have said here:

Continuing the discussion from Footer should be at the bottom, content in the middle:

Starting from here, what I have now: https://jsfiddle.net/t328re49/8/

Here is the back page by itself: https://jsfiddle.net/Loe5av1t/

I am adding it to the back of it which is probably most likely the better choice.

Click on 3 exit buttons and it appears at the end.

A lot of this can be removed, cleaned up, I know that:

Editing it without breaking it, is what I am trying to do.

/*!sc*/
.ewSEqQ {
	-webkit-flex: 1;
	-ms-flex: 1;
	flex: 1;
	-webkit-flex-direction: column;
	-ms-flex-direction: column;
	flex-direction: column;
	-webkit-box-pack: justify;
	-webkit-justify-content: space-between;
	-ms-flex-pack: justify;
	justify-content: space-between;
	padding-left: 16px;
	padding-right: 16px;
	padding-top: 64px;
	padding-bottom: 32px;
	height: 100%;
	width: 100%;
}

@media screen and (min-width:576px) {
	.ewSEqQ {
		padding-bottom: 64px;
	}
}

.dLqIok {
	margin: 0 auto;
	height: 100%;
	width: 100%;
	max-width: 680px;
}

/*!sc*/
.dEtzhK {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: -1;
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
	background-color: #2A3235;
	background-style: flat;
}

/*!sc*/
.dTcluo {
	-webkit-align-items: center;
	-webkit-box-align: center;
	-ms-flex-align: center;
	align-items: center;
	-webkit-flex-direction: column;
	-ms-flex-direction: column;
	flex-direction: column;
	width: 100%;
	height: 100%;
}

/*!sc*/
.eZNKTD {
	margin-bottom: 16px;
}

/*!sc*/
.llgrqs {
	margin-left: 12px;
	margin-right: 12px;
	max-width: 100%;
}

/*!sc*/
.jWrdnz {
	padding-left: 40px;
	padding-right: 40px;
	margin-top: 4px;
}


/*!sc*/
.iqRImb {
	margin-top: 32px;
	margin-bottom: 16px;
}

/*!sc*/
.XXzWu {
	margin-top: 24px;
}

/*!sc*/
.cUWRuD {
	-webkit-flex-wrap: wrap;
	-ms-flex-wrap: wrap;
	flex-wrap: wrap;
	-webkit-box-pack: center;
	-webkit-justify-content: center;
	-ms-flex-pack: center;
	justify-content: center;
	-webkit-align-items: center;
	-webkit-box-align: center;
	-ms-flex-align: center;
	align-items: center;
	width: 100%;
	height: 100%;
}

/*!sc*/
.bhdLno {
	display: -webkit-box;
	display: -webkit-flex;
	display: -ms-flexbox;
	display: flex;
}

/*!sc*/
.bDBxtS {
	margin: 0;
	color: #fff;
	font-weight: 700;
	font-weight: 700;
	font-size: 20px;
	line-height: 1.5;
	text-overflow: ellipsis;
	max-width: 100%;
	white-space: nowrap;
	overflow: hidden;
}

/*!sc*/
.vNLCq {
	padding: 0;
	margin: 0;
	text-align: center;
	line-height: 1.5;
	color: #fff;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.5;
}

/*!sc*/
@media screen and (min-width:576px) {
	.vNLCq {
		font-size: 16px;
	}
}


/*!sc*/
.lbrsth {
	padding-left: 8px;
	padding-right: 8px;
	color: inherit;
	-webkit-text-decoration: underline;
	text-decoration: underline;
}

/*!sc*/
.flTywP {
	width: 96px;
	height: 96px;
	border-radius: 50%;
	width: 96px;
	height: 96px;
	display: block;
	object-fit: contain;
	object-position: initial;
	-webkit-filter: none;
	filter: none;
}

p {
	margin: 0;
	padding: 0;
	border: 0;
	font-size: 100%;
	font: inherit;
	vertical-align: baseline;
	color: #0059dd;
}


/*!sc*/
body {
	line-height: 1;
}


/*!sc*/
html {
	font-family: Inter, sans-serif;
	font-weight: 500;
	font-size: 16px;
	box-sizing: border-box;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/*!sc*/
html>* {
	-webkit-letter-spacing: normal;
	-moz-letter-spacing: normal;
	-ms-letter-spacing: normal;
	letter-spacing: normal;
}


/*!sc*/
.btjemE {
	display: -webkit-box;
	display: -webkit-flex;
	display: -ms-flexbox;
	display: flex;
	-webkit-align-items: center;
	-webkit-box-align: center;
	-ms-flex-align: center;
	align-items: center;
}

/*!sc*/
.cYLuAZ {

	z-index: 0;
}

/*!sc*/
.cYLuAZ:hover {
	-webkit-transform: scale(1.075);
	-ms-transform: scale(1.075);
	transform: scale(1.075);
}

/*!sc*/
.cYLuAZ svg {
	pointer-events: none;
}

.cVBMqs {
	margin-top: 8px;
	fill: rgb(255, 255, 255);
	width: 32px;
	height: 32px;
}

.containerD {
	display: flex;
	justify-content: center;
	align-content: center;
	padding: 8px 8px;
	position: fixed;
	z-index: 3;
	left: 0;
	right: 0;
	top: 0;
	bottom: 0;
	overflow: auto;
}

.my-footer {
	box-sizing: border-box;
	border-top: 0px solid #1155cc;
	background: #121212;
	text-align: center;
	word-wrap: break-word;
	margin: 0 -8px;
	padding: 22px 8px 8px;
	/*height:200px;
  padding: 22px 0 0 0;  height is used    */
	font-family: Verdana, Arial;
	font-size: 13.33px;
	line-height: 1.5;
	vertical-align: baseline;
}

.my-footer a {
	text-decoration: none;
}

.my-footer b {
	width: 1px;
	height: 12px;
	background-color: #f6b26b;
	position: relative;
	top: 4px;
	left: 0;
	margin: 0 7.4px;
}

.footer-top {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	margin-bottom: 13px;
}

.footer-top a {
	color: #0059dd;
	font-weight: 700;
}

.my-footer .text5 {
	color: #38761d;
	font-weight: 400;
}

.text6 {
	color: #b45f06;
	font-weight: 700;
}

.footer-mid {
	margin-bottom: 49px;
	color: #0059dd;
	font-family: Arial;
	font-size: 24px;
	font-weight: 700;
}

.footer-base {
	color: #0059dd;
	padding: 0 0 31px 0;
}
   <div class="containerD hide">
      <div class="inner-container">
         <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;500;600;700&amp;display=swap" rel="stylesheet">
         <div class="bhdLno">
            <div class="ewSEqQ bhdLno">
               <div class=" dLqIok">
                  <div class="dEtzhK eWxyLu"></div>
                  <div class="dTcluo bhdLno">
                     <div class=" eZNKTD">
                        <svg width="136" height="136" viewBox="0 0 136 136">
                           <rect x="0" y="0" width="136" height="136" fill="#38761d" />
                           <rect x="4" y="4" width="128" height="128" fill="black" />
                           <rect x="8" y="8" width="120" height="120" fill="#1155cc" />
                           <rect x="12" y="12" width="112" height="112" fill="black" />
                           <rect x="16" y="16" width="104" height="104" fill="#38761d" />
                           <rect x="20" y="20" width="96" height="96" fill="black" />
                           <rect x="24" y="24" width="88" height="88" fill="#1155cc" />
                           <rect x="28" y="28" width="80" height="80" fill="black" />
                           <rect x="32" y="32" width="72" height="72" fill="#38761d" />
                           <rect x="36" y="36" width="64" height="64" fill="black" />
                           <rect x="40" y="40" width="56" height="56" fill="#1155cc" />
                           <rect x="44" y="44" width="48" height="48" fill="black" />
                           <rect x="48" y="48" width="40" height="40" fill="#38761d" />
                           <rect x="52" y="52" width="32" height="32" fill="black" />
                           <rect x="56" y="56" width="24" height="24" fill="#1155cc" />
                           <rect x="60" y="60" width="16" height="16" fill="black" />
                           <rect x="64" y="64" width="8" height="8" fill="#38761d" />
                           0
                        </svg>
                     </div>
                     <div class="llgrqs btjemE">
                        <h1 class="sc-dlfnbm bDBxtS">Testing Testing</h1>
                     </div>
                     <div class=" jWrdnz">
                        <h2 class="sc-hKgILt vNLCq">[ Testing Testing ]</h2>
                     </div>
                  </div>
               </div>
            </div>
         </div>
         <footer class="my-footer">
            <div class="footer-top">
               <a href=" #" target="_blank">something</a><b></b>
               <a href="#" target="_blank">something</a><b></b>
               <a href="#" target="_blank"><span class="text5">something</span><span class="text6">something</span></a><b></b>
               <a href="#" target="_blank">Feedback</a>
            </div>
            <div class="footer-mid">something</div>
            <div class="footer-base">something</div>
         </footer>
      </div>
   </div>
</div>

It’s unclear what you are asking?

" Adding Footer to the back page, centered in the middle "

You want the footer centered in the middle now?

If you want the whole page centred then just use align-items:center on.containerD

If you want the footer at the bottom and the square centred in the middle of the remaining space then basically use the code I gave you in the other thread.

Remove the align-items:center from the parent and then add styles to inner-container.

.inner-container{
display:flex;
flex-direction:column;
flex:1 0 0;
}
.bhdLno,
.my-footer {margin-top:auto}

Then it will look like this:

I am trying to remove, edit, clean up the code, without the image/code falling apart.

Stop using prefixes for flex properties. They haven’t been needed for years and indeed could break things if you get the wrong order.

I just wanted to center this piece in the middle of the screen


Right now that is stuck at the bottom: https://jsfiddle.net/mov6437j/1/

I try removing stuff from it and the whole thing falls apart.

If you want the whole thing centred then do as I already mentioned and center it from inner-container.

.inner-container {
    display: flex;
    flex-direction: column;
    flex: 1 0 0;
    justify-content: center;
}

remove the margin-top:auto from my-footer and from .bhdLno

(colors just for testing)

And then remove everything else from it?

Do I keep any of the classes?

Only make the changes I showed you. There are no other rules anyway that I can see that affect its positioning.

1 Like

I have this now. https://jsfiddle.net/emgvwxzh/


The footer should be under the buttons, I thought they were until I checked other viewports.

With the buttons, I wanted to add a margin between the middle of each.

<a href="#" class="BUTTON_CBZ ">some text </a>

<a href="#" class="BUTTON_CBZ ">some text </a>

What I am trying to do here is this:

Where it is set in the middle.

.jKflVU {
  min-height: 100dvh;
  position: relative;
}

.dLqIok {
  margin: 0px auto;
  height: 100%;
  width: 100%;
  max-width: 680px;
}

.bhdLno {
  display: flex;
}

.dddSHA {
  flex-direction: column;
  position: relative;
  padding-bottom: 0px;
  overflow-x: hidden;
  width: 100%;
  height: 100%;
}

.bhdLno {
  display: flex;
}

.ewSEqQ {
  flex: 1 1 0%;
  flex-direction: column;
  -webkit-box-pack: justify;
  justify-content: space-between;
  padding: 64px 16px 32px;
  height: 100%;
  width: 100%;
  padding-bottom: 64px;
  background: purple;
}

.mb-4 {
  margin-bottom: 16px;
  background: blue;
}

.dLqIok {
  margin: 0px auto;
  height: 100%;
  width: 100%;
  max-width: 680px;
  background: teal;
}

.ifDGJu {
  position: fixed;
  inset: 0px;
  z-index: -1;
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  background-color: rgb(18, 18, 18);
  background-color: grey;
}

.items-center {
  align-items: center;
}

.flex-col {
  flex-direction: column;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
  background: red;
}

.max-w-full {
  max-width: 100%;
}

.flex {
  display: flex;
}

.mx-3 {
  margin-left: 12px;
  margin-right: 12px;
  background: orange; 
}

.text1 {
  margin: 0px;
  color: #0059dd;
  font-weight: 700;
  font-size: 20px;
  line-height: 1.5;
  text-overflow: ellipsis;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
   font-family: Karla, sans-serif;
}

.px-10 {
  padding-left: 40px;
  padding-right: 40px;
}

.mt-1 {
  margin-top: 4px;
  background: yellow;
}

.text2{
  padding: 0px;
  margin: 0px;
  text-align: center;
  color: #0059dd;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  overflow-wrap: normal;
  font-family: Karla, sans-serif;
  background: pink;
}

.jrDHLp {
  margin-top: 32px;
}

.pkAuV {
  position: relative;
}

.w-full {
  width: 100%;
}

.h-full {
  height: 100%;
}

.dtMawl {
  overflow: hidden;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  -webkit-box-pack: center;
  justify-content: center;
  -webkit-box-align: center;
  align-items: center;
}

.bhdLno {
  display: flex;
}

.dgVnpq {
  left: 4px;
  width: 46px;
  height: 46px;
}

.fmxDzY {
  position: relative;
  hyphens: none;
}

.gXKGT {
  padding: 0px;
  margin: 0px;
  width: 100%;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.5;
}

.liBTRx {
  z-index: 0;
  overflow: hidden;
  transition: box-shadow 0.25s cubic-bezier(0.08, 0.59, 0.29, 0.99) 0s, color 0.25s cubic-bezier(0.08, 0.59, 0.29, 0.99) 0s, border-color 0.25s cubic-bezier(0.08, 0.59, 0.29, 0.99) 0s, transform 0.25s cubic-bezier(0.08, 0.59, 0.29, 0.99) 0s, background-color 0.25s cubic-bezier(0.08, 0.59, 0.29, 0.99) 0s;
  margin-bottom: 16px;
  border: 2px solid rgb(57, 224, 155);
  background-color: rgb(57, 224, 155);
  color: rgb(255, 255, 255);
}

.bNPyPR {
  position: relative;
  height: auto;
}

.pkAuV {
  position: relative;
}

.bNPyPR {
  position: relative;
  height: auto;
}

.bhdLno {
  display: flex;
}

.kzDdRs {
  margin-top: 32px;
  flex-direction: column;
  -webkit-box-align: center;
  align-items: center;
  width: 100%;
  height: 100%;
  background: green;
}

.BUTTON_CBZ {
  padding: 16px 20px;
  width: 100%;
  overflow: hidden;
  line-height: 1.5;
  font-family: "Karla", sans-serif;
  font-size: 16px;
  font-weight: 500;
  font-optical-sizing: auto;
  font-style: normal;
  border: 2px solid #000000;
  border-radius: 0;
  background-color: #000000;
  text-decoration: none;
  color: rgb(255, 255, 255);
  text-align: center;
  display: inline-block;
  cursor: pointer;
  transition: box-shadow 0.25s cubic-bezier(0.08, 0.59, 0.29, 0.99) 0s, border-color 0.25s cubic-bezier(0.08, 0.59, 0.29, 0.99) 0s, transform 0.25s cubic-bezier(0.08, 0.59, 0.29, 0.99) 0s, background-color 0.25s cubic-bezier(0.08, 0.59, 0.29, 0.99) 0s;
}

.BUTTON_CBZ:hover {
  overflow: hidden;
  background: #000000;
  border: 2px solid #0059dd;
  border-radius: 0;
  text-decoration: none;
  transition: box-shadow 0.25s cubic-bezier(0.08, 0.59, 0.29, 0.99) 0s, border-color 0.25s cubic-bezier(0.08, 0.59, 0.29, 0.99) 0s, transform 0.25s cubic-bezier(0.08, 0.59, 0.29, 0.99) 0s, background-color 0.25s cubic-bezier(0.08, 0.59, 0.29, 0.99) 0s;
}

.my-footer {
  box-sizing: border-box;
  border-top: 0px solid #1155cc;
  background: #121212;
  text-align: center;
  word-wrap: break-word;
  margin: 0 -8px;
  padding: 0px 8px 8px;
  font-family: Verdana, Arial;
  font-size: 13.33px;
  line-height: 1.5;
  vertical-align: baseline;
}

.footer-mid {
  margin-bottom: 49px;
  color: #0059dd;
  font-family: Arial;
  font-size: 24px;
  font-weight: 700;
}

.footer-base {
  color: #0059dd;
  padding: 0;
}


html

<div class="sc-bdfBwQ sc-gsTCUz sc-ctaXAZ dddSHA bhdLno jKflVU">

	<div class="sc-bdfBwQ sc-gsTCUz ewSEqQ bhdLno">
		<div class="sc-bdfBwQ dLqIok">
			<div class="sc-bdfBwQ sc-eLgOdN ifDGJu cEudwS"></div>
			<div class="flex flex-col items-center">
				<div class="mb-4" id="profile-picture">
					<svg width="136" height="136" viewBox="0 0 136 136">
						<rect x="0" y="0" width="136" height="136" fill="#38761d" />
						<rect x="4" y="4" width="128" height="128" fill="black" />
						<rect x="8" y="8" width="120" height="120" fill="#1155cc" />
						<rect x="12" y="12" width="112" height="112" fill="black" />
						<rect x="16" y="16" width="104" height="104" fill="#38761d" />
						<rect x="20" y="20" width="96" height="96" fill="black" />
						<rect x="24" y="24" width="88" height="88" fill="#1155cc" />
						<rect x="28" y="28" width="80" height="80" fill="black" />
						<rect x="32" y="32" width="72" height="72" fill="#38761d" />
						<rect x="36" y="36" width="64" height="64" fill="black" />
						<rect x="40" y="40" width="56" height="56" fill="#1155cc" />
						<rect x="44" y="44" width="48" height="48" fill="black" />
						<rect x="48" y="48" width="40" height="40" fill="#38761d" />
						<rect x="52" y="52" width="32" height="32" fill="black" />
						<rect x="56" y="56" width="24" height="24" fill="#1155cc" />
						<rect x="60" y="60" width="16" height="16" fill="black" />
						<rect x="64" y="64" width="8" height="8" fill="#38761d" />
					</svg></div>

				<div class="flex items-center mx-3 max-w-full" id="profile-title">
					<h1 id="profile-testingthis-123" class="sc-dlfnbm text1">Some Text</h1>
				</div>

				<div class="px-10 mt-1" id="profile-description">
					<h2 class="sc-hKgILt text2">Some Text.</h2>
				</div>
			</div>

			<div id="links-container" class="sc-bdfBwQ jrDHLp">
				<div data-id="373254506" class="sc-bdfBwQ pkAuV">

					<a href="#" class="BUTTON_CBZ  ">some text </a>

					<a href="#" class="BUTTON_CBZ  ">some text </a>

					<a href="#" class="BUTTON_CBZ  ">some text </a>

					<a href="#" class="BUTTON_CBZ  ">some text </a>
				</div>
			</div>
		</div>

		<div class="sc-bdfBwQ sc-gsTCUz kzDdRs bhdLno">
			<footer class="my-footer">

				<div class="footer-mid">something</div>
				<div class="footer-base">something</div>
			</footer>

		</div>
	</div>
</div>

This is what I see in Chrome:

https://jsitor.com/

Testing viewport sizes on there is not accurate?

There is a scrollbar there, I am not sure why.

code: https://jsfiddle.net/akhx29g3/

I am trying to center this in the middle.

Can this code be written better for what I am trying to do?

Keeping everything as you see it on the screen.

.main-container {
  min-height: 100dvh;
  position: relative;
}

.flex-display {
  display: flex;
}

.column-flex-container {
  flex-direction: column;
  position: relative;
  padding-bottom: 0px;
  overflow-x: hidden;
  width: 100%;
  height: 100%;
}

.purple-background {
  flex: 1 1 0%;
  flex-direction: column;
  justify-content: space-between;
  padding: 64px 16px 32px;
  height: 100%;
  width: 100%;
  padding-bottom: 64px;
  background: purple;
}

.blue-margin-bottom {
  margin-bottom: 16px;
  background: blue;
}

.teal-container {
  margin: 0px auto;
  height: 100%;
  width: 100%;
  max-width: 680px;
  background: teal;
}

.column-flex {
  flex-direction: column;
}

.flex {
  display: flex;
}

.center-items {
  align-items: center;
  background: red;
}

.full-width {
  max-width: 100%;
}

.orange-margin {
  margin-left: 12px;
  margin-right: 12px;
  background: orange;
}

.title-text {
  margin: 0px;
  color: #0059dd;
  font-weight: 700;
  font-size: 20px;
  line-height: 1.5;
  text-overflow: ellipsis;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  font-family: Karla, sans-serif;
}

.large-padding {
  padding-left: 40px;
  padding-right: 40px;
}

.yellow-margin-top {
  margin-top: 4px;
  background: yellow;
}

.center-text {
  padding: 0px;
  margin: 0px;
  text-align: center;
  color: #0059dd;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  overflow-wrap: normal;
  font-family: Karla, sans-serif;
  background: pink;
}

.margin-top {
  margin-top: 32px;
}

.relative-position {
  position: relative;
}

.footer {
  position: relative;
  z-index:99;
  box-sizing: border-box;
  border-top: 1px solid #1155cc;
  background: #121212;
  text-align: center;
  word-wrap: break-word;
  padding: 22px 8px 8px;
  font-family: Verdana, Arial;
  font-size: 13.33px;
  line-height: 1.5;
  vertical-align: baseline;
  margin-top: auto;
}

.footer a {
  text-decoration: none;
}

.footer b {
  width: 1px;
  height: 12px;
  background-color: #f6b26b;
  position: relative;
  top: 4px;
  left: 0;
  margin: 0 7.4px;
}

.footer-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 13px;
}

.footer-top a {
  color: #0059dd;
  font-weight: 700;
}

.footer .green-text {
  color: #38761d;
  font-weight: 400;
}

.brown-text {
  color: #b45f06;
  font-weight: 700;
}

.footer-mid {
  margin-bottom: 49px;
  color: #0059dd;
  font-family: Arial;
  font-size: 24px;
  font-weight: 700;
}

.footer-base {
  color: #0059dd;
  padding: 0 0 31px 0;
}
<div class="column-flex-container flex-display main-container">

	<div class="purple-background flex-display">
		<div class="teal-container">

			<div class="flex column-flex center-items">
				<div class="blue-margin-bottom">
					<svg width="136" height="136" viewBox="0 0 136 136">
						<rect x="0" y="0" width="136" height="136" fill="#38761d" />
						<rect x="4" y="4" width="128" height="128" fill="black" />
						<rect x="8" y="8" width="120" height="120" fill="#1155cc" />
						<rect x="12" y="12" width="112" height="112" fill="black" />
						<rect x="16" y="16" width="104" height="104" fill="#38761d" />
						<rect x="20" y="20" width="96" height="96" fill="black" />
						<rect x="24" y="24" width="88" height="88" fill="#1155cc" />
						<rect x="28" y="28" width="80" height="80" fill="black" />
						<rect x="32" y="32" width="72" height="72" fill="#38761d" />
						<rect x="36" y="36" width="64" height="64" fill="black" />
						<rect x="40" y="40" width="56" height="56" fill="#1155cc" />
						<rect x="44" y="44" width="48" height="48" fill="black" />
						<rect x="48" y="48" width="40" height="40" fill="#38761d" />
						<rect x="52" y="52" width="32" height="32" fill="black" />
						<rect x="56" y="56" width="24" height="24" fill="#1155cc" />
						<rect x="60" y="60" width="16" height="16" fill="black" />
						<rect x="64" y="64" width="8" height="8" fill="#38761d" />
					</svg>
				</div>


				<div class="flex center-items orange-margin full-width">
					<h1 class="title-text">Some Text</h1>
				</div>

				<div class="large-padding yellow-margin-top">
					<h2 class="center-text">Some Text.</h2>
				</div>
			</div>

			<div class="margin-top">
				<div class="relative-position ">

					<footer class="footer">
						<div class="footer-top">
							<a href=" #" target="_blank">something</a><b>
        <!--|--></b>
							<a href="#" target="_blank">something</a><b>
        <!--|--></b>
							<a href="#"
								target="_blank"><span class="green-text">something</span><span class="brown-text">something</span></a><b></b>

							<a href="#" target="_blank">Feedback</a>
						</div>
						<div class="footer-mid">something</div>
						<div class="footer-base">something</div>
					</footer>
				</div>
			</div>
		</div>


All of this here is fine, how it is all positioned,

I just want to place it in the middle of the page.

Yes you do you’ve been told his many times. there is a default margin on the body element so your 100% high element is too tall and causes a scrollbar. Remove the margins from the body.

Also what do you think 100% width and height will do to his element (had it worked).

.purple-background {
    flex: 1 1 0%;
    flex-direction: column;
    justify-content: space-between;
    padding: 64px 16px 32px;
    height: 100%;
    width: 100%;
    padding-bottom: 64px;
    background: purple;
}

That would have been 96px taller than the viewport but luckily for you you can’t base height:100% unless there is an unbroken chain of heights back to the root element (html). Therefore all you get is height:auto but again luckily the flex is there to stretch it anyway. You were not so lucky with the width:100% though as that makes it 32px too large for its container.

Remove both width and height.

Also same error here:

.column-flex-container {
    flex-direction: column;
    position: relative;
    padding-bottom: 0px;
    overflow-x: hidden;
    width: 100%;
    height: 100%;
}

The 100% height is never used as it fails to auto and the width:100% is not needed either. It;s the min-height here that is holding it open.

.main-container {
    min-height: 100dvh;
    position: relative;
}

That’s so many lessons in one place that I have repeated over and over again and you should have immediately been familiar with those types of problems by now. :slight_smile:

That would simple be achieved by using margin:auto here.

.teal-container {
    margin: auto;
}

Bearing in mind that on the parent (purple-background) you have pointless 64px top padding and 32px bottom padding so the centering of the teal container will be out by 32px. I would remove the top and bottom padding or just add the same padding. No need for such a large number as that just means the screen has to be much taller before it all fits.

1 Like

I have this now: https://jsfiddle.net/9ob80fwy/2/

Added to the back page of the full video code here: https://jsfiddle.net/1j3Lha7d/1/

.containerD {
  display: flex;
  justify-content: center;
  align-content: center;
  padding: 8px 8px;
  position: fixed;
  z-index: 3;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  overflow: auto;
  
  /* Enable scroll if needed */
  --units: 8px;
  --brick1: #222;
  --brick2: #222;
  --lines: #121212;
  --gp-ln: 50%/calc(var(--units) * 10) calc(var(--units) * 5);
  --gp-cn: 50%/calc(var(--units) * 5) calc(var(--units) * 5);
  background:repeating-conic-gradient(from 90deg at 95% 55%, var(--lines) 0% 25%, #fff0 0% 100%) var(--gp-cn),
    repeating-linear-gradient(180deg, var(--lines) 0 5%, #fff0 0 50%, var(--lines) 0 55%, var(--brick2) 0 100%) var(--gp-ln),
    repeating-linear-gradient(90deg, var(--brick1) 0 47.5%, var(--lines) 0 50%, var(--brick1) 0 97.5%, var(--lines) 0 100%) var(--gp-ln);
}

.inner-container {
  flex: 1 0 0;
  margin: auto;
  max-width: 640px;
  position: relative;
}

.blue-margin-bottom {
  margin-bottom: 16px;
  background: blue;
}

.teal-container {
  background: teal;
}

.column-flex {
  flex-direction: column;
}

.flex {
  display: flex;
}

.center-items {
  align-items: center;
  background: red;
}

.orange-margin {
  margin-left: 12px;
  margin-right: 12px;
  background: orange;
}

.title-text {
  margin: 0px;
  color: #0059dd;
  font-weight: 700;
  font-size: 20px;
  line-height: 1.5;
  text-overflow: ellipsis;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  font-family: Karla, sans-serif;
}

.large-padding {
  padding-left: 40px;
  padding-right: 40px;
}

.yellow-margin-top {
  margin-top: 4px;
  background: yellow;
}

.center-text {
  padding: 0px;
  margin: 0px;
  text-align: center;
  color: #0059dd;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  overflow-wrap: normal;
  font-family: Karla, sans-serif;
  background: pink;
}

.margin-top {
  margin-top: 32px;
  
}

.footer {
  box-sizing: border-box;
  border-top: 1px solid #1155cc;
  background: #121212;
  text-align: center;
  word-wrap: break-word;
  padding: 22px 8px 8px;
  font-family: Verdana, Arial;
  font-size: 13.33px;
  line-height: 1.5;
  vertical-align: baseline;
  margin-top: auto;
}

.footer a {
  text-decoration: none;
}

.footer b {
  width: 1px;
  height: 12px;
  background-color: #f6b26b;
  position: relative;
  top: 4px;
  left: 0;
  margin: 0 7.4px;
}

.footer-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 13px;
}

.footer-top a {
  color: #0059dd;
  font-weight: 700;
}

.footer .green-text {
  color: #38761d;
  font-weight: 400;
}

.brown-text {
  color: #b45f06;
  font-weight: 700;
}

.footer-mid {
  margin-bottom: 49px;
  color: #0059dd;
  font-family: Arial;
  font-size: 24px;
  font-weight: 700;
}

.footer-base {
  color: #0059dd;
  padding: 0 0 31px 0;
}
<div class="containerD">

<div class="inner-container ">
	
			<div class="teal-container">

				<div class="flex column-flex center-items">
					<div class="blue-margin-bottom">
						<svg width="136" height="136" viewBox="0 0 136 136">
							<rect x="0" y="0" width="136" height="136" fill="#38761d" />
							<rect x="4" y="4" width="128" height="128" fill="black" />
							<rect x="8" y="8" width="120" height="120" fill="#1155cc" />
							<rect x="12" y="12" width="112" height="112" fill="black" />
							<rect x="16" y="16" width="104" height="104" fill="#38761d" />
							<rect x="20" y="20" width="96" height="96" fill="black" />
							<rect x="24" y="24" width="88" height="88" fill="#1155cc" />
							<rect x="28" y="28" width="80" height="80" fill="black" />
							<rect x="32" y="32" width="72" height="72" fill="#38761d" />
							<rect x="36" y="36" width="64" height="64" fill="black" />
							<rect x="40" y="40" width="56" height="56" fill="#1155cc" />
							<rect x="44" y="44" width="48" height="48" fill="black" />
							<rect x="48" y="48" width="40" height="40" fill="#38761d" />
							<rect x="52" y="52" width="32" height="32" fill="black" />
							<rect x="56" y="56" width="24" height="24" fill="#1155cc" />
							<rect x="60" y="60" width="16" height="16" fill="black" />
							<rect x="64" y="64" width="8" height="8" fill="#38761d" />
						</svg>
					</div>

					<div class="flex center-items orange-margin">
						<h1 class="title-text">Some Text</h1>
					</div>

					<div class="large-padding yellow-margin-top">
						<h2 class="center-text">Some Text.</h2>
					</div>
				</div>

			<div class="margin-top">
						<footer class="footer">
							<div class="footer-top">
								<a href=" #" target="_blank">something</a><b>
        <!--|--></b>
								<a href="#" target="_blank">something</a><b>
        <!--|--></b>
								<a href="#"
									target="_blank"><span class="green-text">something</span><span class="brown-text">something</span></a><b></b>

								<a href="#" target="_blank">Feedback</a>
							</div>
							<div class="footer-mid">something</div>
							<div class="footer-base">something</div>
						</footer>
					</div>
			</div>
		</div>
	</div>
</div>

Improved some more: https://jsfiddle.net/u5jyt0rs/5/

Anything you would change in here?

css

.containerD {
  display: flex;
  justify-content: center;
  align-content: center;
  padding: 8px 8px;
  position: fixed;
  z-index: 3;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  overflow: auto;

  /* Enable scroll if needed */
  --units: 8px;
  --brick1: #222;
  --brick2: #222;
  --lines: #121212;
  --gp-ln: 50%/calc(var(--units) * 10) calc(var(--units) * 5);
  --gp-cn: 50%/calc(var(--units) * 5) calc(var(--units) * 5);
  background: repeating-conic-gradient(from 90deg at 95% 55%, var(--lines) 0% 25%, #fff0 0% 100%) var(--gp-cn),
    repeating-linear-gradient(180deg, var(--lines) 0 5%, #fff0 0 50%, var(--lines) 0 55%, var(--brick2) 0 100%) var(--gp-ln),
    repeating-linear-gradient(90deg, var(--brick1) 0 47.5%, var(--lines) 0 50%, var(--brick1) 0 97.5%, var(--lines) 0 100%) var(--gp-ln);
}

.inner-container {
  margin: auto;
  background: teal;
}

.flex {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: red;
}

.blue-margin-bottom {
  margin-bottom: 16px;
  background: blue;
}

.orange-margin {
  margin-left: 12px;
  margin-right: 12px;
  background: orange;
}

.title-text {
  margin: 0px;
  color: #0059dd;
  font-weight: 700;
  font-size: 20px;
  line-height: 1.5;
  text-overflow: ellipsis;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  font-family: Karla, sans-serif;
}

.yellow-padding-margin {
  margin-top: 4px;
  padding-left: 40px;
  padding-right: 40px;
  background: yellow;
}

.center-text {
  padding: 0px;
  margin: 0px;
  text-align: center;
  color: #0059dd;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  overflow-wrap: normal;
  font-family: Karla, sans-serif;
  background: pink;
}

.margin-top {
  margin-top: 32px;
}

.my-footer {
  box-sizing: border-box;
  border-top: 1px solid #1155cc;
  background: #121212;
  text-align: center;
  word-wrap: break-word;
  padding: 22px 8px 8px;
  font-family: Verdana, Arial;
  font-size: 13.33px;
  line-height: 1.5;
  vertical-align: baseline;
  margin-top: auto;
}

.my-footer a {
  text-decoration: none;
}

.my-footer b {
  width: 1px;
  height: 12px;
  background-color: #f6b26b;
  position: relative;
  top: 4px;
  left: 0;
  margin: 0 7.4px;
}

.footer-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 13px;
}

.footer-top a {
  color: #0059dd;
  font-weight: 700;
}

.my-footer .green-text {
  color: #38761d;
  font-weight: 400;
}

.brown-text {
  color: #b45f06;
  font-weight: 700;
}

.footer-mid {
  margin-bottom: 49px;
  color: #0059dd;
  font-family: Arial;
  font-size: 24px;
  font-weight: 700;
}

.footer-base {
  color: #0059dd;
  padding: 0 0 31px 0;
}

html

<div class="containerD">

  <div class="inner-container ">

    <div class="flex">
      <div class="blue-margin-bottom">
        <svg width="136" height="136" viewBox="0 0 136 136">
          <rect x="0" y="0" width="136" height="136" fill="#38761d" />
          <rect x="4" y="4" width="128" height="128" fill="black" />
          <rect x="8" y="8" width="120" height="120" fill="#1155cc" />
          <rect x="12" y="12" width="112" height="112" fill="black" />
          <rect x="16" y="16" width="104" height="104" fill="#38761d" />
          <rect x="20" y="20" width="96" height="96" fill="black" />
          <rect x="24" y="24" width="88" height="88" fill="#1155cc" />
          <rect x="28" y="28" width="80" height="80" fill="black" />
          <rect x="32" y="32" width="72" height="72" fill="#38761d" />
          <rect x="36" y="36" width="64" height="64" fill="black" />
          <rect x="40" y="40" width="56" height="56" fill="#1155cc" />
          <rect x="44" y="44" width="48" height="48" fill="black" />
          <rect x="48" y="48" width="40" height="40" fill="#38761d" />
          <rect x="52" y="52" width="32" height="32" fill="black" />
          <rect x="56" y="56" width="24" height="24" fill="#1155cc" />
          <rect x="60" y="60" width="16" height="16" fill="black" />
          <rect x="64" y="64" width="8" height="8" fill="#38761d" />
        </svg>
      </div>

      <div class="orange-margin">
        <h1 class="title-text">Some Text</h1>
      </div>

      <div class="yellow-padding-margin">
        <h2 class="center-text">Some Text.</h2>
      </div>
    </div>

    <div class="margin-top">

      <footer class="my-footer">
        <div class="footer-top">
          <a href=" #" target="_blank">something</a><b>
            <!--|--></b>
          <a href="#" target="_blank">something</a><b>
            <!--|--></b>
          <a href="#" target="_blank"><span class="green-text">something</span><span class="brown-text">something</span></a><b></b>

          <a href="#" target="_blank">Feedback</a>
        </div>
        <div class="footer-mid">something</div>
        <div class="footer-base">something</div>
      </footer>
    </div>
  </div>
</div>

That’s looking better.

You don’t need the margin-top div that surrounds the footer (a badly named class anyway). Remove that div and just put the 32px margin-top on that footer element. Note that if you use the same html and css for the footer in other pages (modals) then removing the margin-top:auto will mean it doesn’t push itself down to the end of a flex-container (such as in a full height page). If that’s the case then just add the margin-top class to the footer element instead and give it a more aptly named classname :slight_smile:

Doing this does not work:

<footer class="my-footer margin-top"> https://jsfiddle.net/3xqj02uo/1/

Doing this does not work: https://jsfiddle.net/3xqj02uo/3/

.my-footer {
  margin-top: 32px;

The css for margin-top has to come after the css for the footer otherwise the css on the footer wins out.

Basic laws of css. You know this :slight_smile:

I don’t understand what you mean.

I did it: https://jsfiddle.net/1bjpea65/1/

.my-footer {
  box-sizing: border-box;
  border-top: 1px solid #1155cc;
  background: #121212;
  text-align: center;
  word-wrap: break-word;
  padding: 22px 8px 8px;
  font-family: Verdana, Arial;
  font-size: 13.33px;
  line-height: 1.5;
  vertical-align: baseline;
  margin-top: auto;
}

.margin-top {
  margin-top: 10px;
}
1 Like