How to rotate a sidebar nav menu as in the model? - html

I'll explain what I'm looking for. At the moment, I created the entire layout with a CSS grid, I just missed the sidenavbar (example on the first link), but I don't know how to make a list fit in the grid, once I transform: rotate my element it goes away from the screen.
This is the model:
This is where I stand at the moment.
#import url('https://fonts.googleapis.com/css2?family=Noto+Sans:wght#100&display=swap');
* {
padding: 0;
margin: 0;
box-sizing: border-box;
font-size: medium;
font-family: noto;
}
:root {
/* colors */
--colNoirPhoto: #181818;
--col1: #2F4858;
--col2: #165B6F;
--col3: #00707E;
--col4: #008483;
--col5: #00987D;
--col6: #04AA6D;
--alt1: #0BE0BA;
--alt2: #00BFC9;
--alt3: #ffffff;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: 'Noto Sans', sans-serif;
}
/*side nav bar*/
.sidebar {
display: flex;
position: fixed;
width: 10%;
height: 100%;
color: var(--alt3);
}
/* top content--------------------------------------------------------------------------------*/
.topcontainer {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: 1fr;
background-color: var(--colNoirPhoto);
margin-top: 7%;
width: 100%;
height: 20vh;
padding-left: 2vh;
}
.titretopcontainer {
color: var(--alt3);
display: flex;
flex-direction: column;
justify-content: center;
}
.tiretopcontainer h1 {
font-size: 18px;
}
.topcontainer img {
display: flex;
flex-direction: row;
align-items: center;
width: 88%;
grid-row-start: 1;
grid-column-start: 2;
}
/* fin detop content--------------------------------------------------------------------------------*/
/* biographie content--------------------------------------------------------------------------------*/
.containerAllContent {
display: grid;
grid-template-columns: 10% 90%;
background-image: url(/background\ page\ content.png);
}
.separateurdechapitre1 {
display: flex;
padding-left: 1vh;
padding-right: 1vh;
padding-top: 1vh;
background-color: var(--col1);
height: 5vh;
color: var(--alt3);
grid-column-start: 2;
}
.separateurdechapitre2 {
display: flex;
padding-left: 1vh;
padding-right: 1vh;
padding-top: 1vh;
background-color: var(--col2);
height: 5vh;
color: var(--alt3);
grid-column-start: 2;
}
.separateurdechapitre3 {
display: flex;
padding-left: 1vh;
padding-right: 1vh;
padding-top: 1vh;
background-color: var(--col3);
height: 5vh;
color: var(--alt3);
grid-column-start: 2;
}
.separateurdechapitre4 {
display: flex;
padding-left: 1vh;
padding-right: 1vh;
padding-top: 1vh;
background-color: var(--col4);
height: 5vh;
color: var(--alt3);
grid-column-start: 2;
}
.content {
padding-left: 2vh;
padding-right: 2vh;
padding-top: 2vh;
padding-bottom: 2vh;
grid-column-start: 2;
}
/* fin de biographie content--------------------------------------------------------------------------------*/
p {
color: black;
}
footer {
background-color: var(--col1);
}
<main>
<div class="topcontainer">
<div class="titretopcontainer">
<h1>John Conway
</h1>
<h2> Créateur du jeu de la vie
</h2>
</div>
<img src="/Photo de John Conway.png" alt="Photo de John Conway">
</div>
<div class="containerAllContent">
<div class="sidebar">
<a href="">Biographie
</a>
<a href="">Réalisations
</a>
<a href="">Distinctions
</a>
<a href="">Voir aussi
</a>
</div>
<div class="separateurdechapitre1">
<h6>En quelques lignes
</h6>
</div>
<div class="content">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Architecto laudantium, temporibus nemo possimus inventore
soluta amet exercitationem cumque nobis quasi?
</p>
</div>
<div class="separateurdechapitre2">
<h6>En quelques lignes
</h6>
</div>
<div class="content">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Architecto laudantium, temporibus nemo possimus inventore
soluta amet exercitationem cumque nobis quasi?
</p>
</div>
<div class="separateurdechapitre3">
<h6>En quelques lignes
</h6>
</div>
<div class="content">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Architecto laudantium, temporibus nemo possimus inventore
soluta amet exercitationem cumque nobis quasi?
</p>
</div>
<div class="separateurdechapitre4">
<h6>En quelques lignes
</h6>
</div>
<div class="content">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Architecto laudantium, temporibus nemo possimus inventore
soluta amet exercitationem cumque nobis quasi?
</p>
</div>
</div>
</main>
<footer>
<p>-
</p>
</footer>

Reading your question, I did not fully understand:
If you want your sidebar menu to be aligned vertically instead of horizontally as before.
Or whether you want the menu text to be laid out vertically.
Solution for 1.:
This can be done by setting the CSS property's flex-direction value to column for the element <div class="sidebar">.
CSS
.sidebar {
display: flex;
flex-direction: column;
position: fixed;
width: 10%;
height: 100%;
color: var(--alt3);
}
Solution for 2.:
This can be done by setting the CSS property's writing-mode value to vertical-lr for the element <div class="sidebar">.
CSS
.sidebar {
display: flex;
writing-mode: vertical-lr;
position: fixed;
width: 10%;
height: 100%;
color: var(--alt3);
}

Related

Why is my footer covering up all my main content when I resize my screen

This is my first webpage ever and I'm very new to this. I've been googling but I can't find a solution to this problem.
I've tried messing around with positioning and or adding containers but I can't get my footer to stay under my page. When resizing, it moves up and collides with all the content on the page
Forgive my code, but it's all over the place with media queries and comments from trying random things out.
Any guidance or pointers are appreciated!
(Also I know this is a "code dump and fix my problem" but my structure is pretty bad and maybe the problem could be elsewhere other than the footer and main content)
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
/*html, body {*/
/* height: 100%;*/
/*}*/
/*.wrapper {*/
/* min-height: 100%;*/
/*}*/
.wrapper {
position:relative;
min-height: 100vh;
}
/*.content-wrap {*/
/* padding-bottom: 348px;*/
/*}*/
/*------------------- background ------------------------*/
.background-container{
background-size: 40px 40px;
background-image: radial-gradient(circle, #696969 1px, rgba(0, 0, 0, 0) 1px);
position: relative;
font-family: 'Titillium Web', sans-serif;
/*padding-bottom: 348px;*/
}
/*------------------- nav ------------------------*/
nav {
display: flex;
padding: 2% 6%;
align-items: center;
justify-content: space-between;
}
nav img {
width: 150px;
}
.nav-links {
flex: 1;
text-align: right;
}
.nav-links ul li {
list-style: none;
display: inline-block;
position: relative;
padding: 8px 12px;
}
.nav-links ul li a {
color: black;
text-decoration: none;
font-size: 17px;
font-weight: 600;
}
.nav-links ul li::after {
content: '';
width: 0%;
height: 2px;
background: black;
display: block;
margin: auto;
transition: 0.5s;
}
.nav-links ul li:hover::after {
width: 100%;
}
.fa-solid {
display: none;
}
/*------------------- main ------------------------*/
main {
background-size: 40px 40px;
background-image: radial-gradient(circle, #696969 1px, rgba(0, 0, 0, 0) 1px);
/*height stuff i found to calc height of main*/
height: calc( 100vh - 161px);
align-items: center;
justify-content: center;
font-family: 'Titillium Web', sans-serif;
}
.title{
display: flex;
margin-left: auto;
margin-right: auto;
align-items: center;
justify-content: center;
font-weight: 700;
margin-bottom: 100px;
padding-top: 100px;
}
.grid-ish {
display: grid;
height: 100vh;
grid-template-columns: 1fr 1fr;
grid-template-rows: .3fr .3fr;
grid-template-areas:
"spotify discord"
"tracker idk";
grid-gap: 3rem;
margin: auto;
width: 50%;
}
.spotify {
grid-area: spotify;
background: #e9d138;
display: flex;
justify-content: center;
flex-direction: column;
padding: 30px;
border-radius: 15px;
text-align: left;
}
.spotify h2{
font-weight: 700;
text-align: left;
margin-bottom: 30px;
}
.discord {
grid-area: discord;
background: #e9d138;
display: flex;
justify-content: center;
flex-direction: column;
padding: 30px;
border-radius: 15px;
text-align: left;
height: 21em;
}
.discord h2{
font-weight: 700;
text-align: left;
margin-bottom: 30px;
}
.tracker {
grid-area: tracker;
background: #e9d138;
display: flex;
justify-content: center;
flex-direction: column;
padding: 30px;
border-radius: 15px;
text-align: left;
height: 18em;
}
.tracker h2{
font-weight: 700;
text-align: left;
margin-bottom: 30px;
}
.idk {
grid-area: idk;
background: #e9d138;
display: flex;
justify-content: center;
flex-direction: column;
padding: 30px;
border-radius: 15px;
text-align: left;
height: 15em;
}
.idk h2{
font-weight: 700;
text-align: left;
margin-bottom: 30px;
}
#media(max-width: 700px){
/*------ display none ------*/
/*------ nav ------*/
nav img {
display: none;
}
.nav-links ul li{
display: block;
}
html, body {
/*still dunno how this solves my overflow*/
/*but oh well*/
overflow-x:hidden;
}
.nav-links{
position: absolute;
background: #e9d138;
height: 100vh;
width: 200px;
top: 0;
right: -200px;
text-align: left;
transition: 1s;
z-index: 2;
}
nav .fa-xmark{
display: block;
color: black;
margin: 10px;
font-size: 22px;
cursor: pointer;
}
nav .fa-bars{
display: block;
color: black;
margin: 38px 20px 0 0;
font-size: 30px;
cursor: pointer;
}
.nav-links ul{
padding: 30px;
}
/*------ main ------*/
main {
height: 100%;
}
}
#media(max-width: 1000px){
/*------ display none ------*/
/*------ main ------*/
main {
height: 100%;
}
}
/*------------------- footer ------------------------*/
.footer-container {
position: relative;
bottom: 0;
left: 0;
right: 0;
background: white;
background-size: 40px 40px;
/*background-color: gray;*/
background-image: radial-gradient(circle, #696969 1px, rgba(0, 0, 0, 0) 1px);
display: flex;
margin-top:auto;
z-index: -11;
/*margin-top: -348px;*/
/*clear: both;*/
}
.footer{
width: 80%;
text-align: center;
margin: 0 auto;
justify-content: center;
flex-wrap: wrap;
margin-bottom: 4rem;
}
.footer1{
padding-top: 6rem;
}
.footer2{
display: flex;
align-items: center;
justify-content: center;
margin-top: 2rem;
}
.footer2 a{
text-decoration: none;
color: black;
margin-left: 2rem;
transition: .5s;
}
.footer2 a:hover{
transform: translate(0, -5px);
}
.footer3{
display: flex;
align-items: center;
justify-content: center;
margin: 3rem 0 0;
}
.footer3 a{
margin: 0 2rem;
text-decoration: none;
color: black;
font-size: 30px;
transition: .5s;
}
.footer3 a:hover{
transform: translate(0, -5px);
}
#media(max-width: 700px){
.footer1{
padding-top: 30px;
}
.footer3{
margin: 2rem 0 0;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.2/css/all.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/#fortawesome/fontawesome-free#6.1.2/css/fontawesome.min.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Titillium+Web&display=swap" rel="stylesheet">
<link href="styles3.css" rel="stylesheet">
</head>
<body>
<!------------------------------- nav ------------------------------->
<div class="wrapper">
<div class= "content-wrap">
<div class="background-container">
<nav>
<img src="assets/logo.png">
<div class="nav-links" id="navLinks">
<i class="fa-solid fa-xmark" onclick="hideMenu()"></i>
<ul>
<li>HOME</li>
<li>ABOUT</li>
<li>PROJECTS</li>
<li>WHAT I'VE BEEN UP TO</li>
</ul>
</div>
<i class="fa-solid fa-bars" onclick="showMenu()"></i>
</nav>
</div>
<!------------------------------- main content ------------------------------->
<main>
<h1 class="title">Projects</h1>
<div class="grid-ish">
<div class="spotify">
<h2>Spotify Playlist -> Youtube Downloader</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Esse ullam sequi, nam repellendus ab, repellat maiores. Saepe
voluptatem at asperiores obcaecati qui culpa, hic sint voluptatum
ad consequuntur voluptas dolorem?<br> <br>Lorem ipsum dolor sit amet,
consectetur adipisicing elit. Itaque, facere iste, eligendi ipsa rerum
voluptas officia ullam eius iusto eaque.</p>
</div>
<div class="discord">
<h2>Discord Bot</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Esse ullam sequi, nam repellendus ab, repellat maiores. Saepe
voluptatem at asperiores obcaecati qui culpa, hic sint voluptatum
ad consequuntur voluptas dolorem?Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Esse ullam sequi, nam repellendus ab, repellat maiores. Saepe
voluptatem at asperiores obcaecati qui culpa, hic sint voluptatum
ad consequuntur voluptas dolorem?</p>
</div>
<div class="tracker">
<h2>Financial Tracker</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Cupiditate
alias ducimus animi, voluptatem quaerat? Aliquam, fuga, distinctio! Modi
veritatis quam quisquam molestias eveniet temporibus incidunt dolorem
quaerat obcaecati tempora possimus, aperiam, qui.</p>
</div>
<div class="idk">
<h2>Haven't Decided</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quis
placeat, dolores maxime, assumenda aspernatur repellendus? Officiis
maxime obcaecati nisi maiores. ipsum dolor sit amet, consectetur
adipisicing elit. Eligendi</p>
</div>
</div>
</main>
</div>
<!------------------------------- footer ------------------------------->
<footer>
<div class= "footer-container">
<div class="footer">
<div class="footer1">
<h2>Luca Henderson</h2>
</div>
<div class="footer2">
Home
About
Projects
What I've Been Up To
</div>
<div class="footer3">
<i class="fab fa-linkedin"></i>
<i class="fab fa-github"></i>
<i class="fab fa-angellist"></i>
</div>
</div>
</div>
</footer>
</div>
<!--<-------------JavaScript for Toggle Menu------------>
<script>
var navLinks = document.getElementById("navLinks");
function showMenu(){
navLinks.style.right ="0";
}
function hideMenu(){
navLinks.style.right = "-200px";
}
</script>
</body>
</html>
I did some changes to your code in the css you have to put fit content as height instead of a hard coded height that's why your content keep overflowing and cover the footer.
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
/*html, body {*/
/* height: 100%;*/
/*}*/
/*.wrapper {*/
/* min-height: 100%;*/
/*}*/
.wrapper {
position:relative;
min-height: 100vh;
}
/*.content-wrap {*/
/* padding-bottom: 348px;*/
/*}*/
.content-wrap{
height: fit-content;
}
/*------------------- background ------------------------*/
.background-container{
background-size: 40px 40px;
background-image: radial-gradient(circle, #696969 1px, rgba(0, 0, 0, 0) 1px);
position: relative;
font-family: 'Titillium Web', sans-serif;
/*padding-bottom: 348px;*/
}
/*------------------- nav ------------------------*/
nav {
display: flex;
padding: 2% 6%;
align-items: center;
justify-content: space-between;
}
nav img {
width: 150px;
}
.nav-links {
flex: 1;
text-align: right;
}
.nav-links ul li {
list-style: none;
display: inline-block;
position: relative;
padding: 8px 12px;
}
.nav-links ul li a {
color: black;
text-decoration: none;
font-size: 17px;
font-weight: 600;
}
.nav-links ul li::after {
content: '';
width: 0%;
height: 2px;
background: black;
display: block;
margin: auto;
transition: 0.5s;
}
.nav-links ul li:hover::after {
width: 100%;
}
.fa-solid {
display: none;
}
/*------------------- main ------------------------*/
main {
background-size: 40px 40px;
background-image: radial-gradient(circle, #696969 1px, rgba(0, 0, 0, 0) 1px);
/*height stuff i found to calc height of main*/
/*height: calc( 100vh - 161px); this is not needed*/
align-items: center;
justify-content: center;
font-family: 'Titillium Web', sans-serif;
}
.title{
display: flex;
margin-left: auto;
margin-right: auto;
align-items: center;
justify-content: center;
font-weight: 700;
margin-bottom: 100px;
padding-top: 100px;
}
.grid-ish {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: .3fr .3fr;
grid-template-areas:
"spotify discord"
"tracker idk";
grid-gap: 3rem;
margin: auto;
width: 50%;
height: fit-content;
}
.spotify {
grid-area: spotify;
background: #e9d138;
display: flex;
justify-content: center;
flex-direction: column;
padding: 30px;
border-radius: 15px;
text-align: left;
}
.spotify h2{
font-weight: 700;
text-align: left;
margin-bottom: 30px;
}
.discord {
grid-area: discord;
background: #e9d138;
display: flex;
justify-content: center;
flex-direction: column;
padding: 30px;
border-radius: 15px;
text-align: left;
height: 21em;
}
.discord h2{
font-weight: 700;
text-align: left;
margin-bottom: 30px;
}
.tracker {
grid-area: tracker;
background: #e9d138;
display: flex;
justify-content: center;
flex-direction: column;
padding: 30px;
border-radius: 15px;
text-align: left;
height: 18em;
}
.tracker h2{
font-weight: 700;
text-align: left;
margin-bottom: 30px;
}
.idk {
grid-area: idk;
background: #e9d138;
display: flex;
justify-content: center;
flex-direction: column;
padding: 30px;
border-radius: 15px;
text-align: left;
height: 15em;
}
.idk h2{
font-weight: 700;
text-align: left;
margin-bottom: 30px;
}
#media(max-width: 700px){
/*------ display none ------*/
/*------ nav ------*/
nav img {
display: none;
}
.nav-links ul li{
display: block;
}
html, body {
/*still dunno how this solves my overflow*/
/*but oh well*/
overflow-x:hidden;
}
.nav-links{
position: absolute;
background: #e9d138;
height: 100vh;
width: 200px;
top: 0;
right: -200px;
text-align: left;
transition: 1s;
z-index: 2;
}
nav .fa-xmark{
display: block;
color: black;
margin: 10px;
font-size: 22px;
cursor: pointer;
}
nav .fa-bars{
display: block;
color: black;
margin: 38px 20px 0 0;
font-size: 30px;
cursor: pointer;
}
.nav-links ul{
padding: 30px;
}
/*------ main ------*/
main {
height: 100%;
}
}
#media(max-width: 1000px){
/*------ display none ------*/
/*------ main ------*/
main {
height: 100%;
}
}
/*------------------- footer ------------------------*/
.footer-container {
position: relative;
bottom: 0;
left: 0;
right: 0;
background: white;
background-size: 40px 40px;
/*background-color: gray;*/
background-image: radial-gradient(circle, #696969 1px, rgba(0, 0, 0, 0) 1px);
display: flex;
margin-top:auto;
z-index: -11;
/*margin-top: -348px;*/
/*clear: both;*/
}
.footer{
width: 80%;
text-align: center;
margin: 0 auto;
justify-content: center;
flex-wrap: wrap;
margin-bottom: 4rem;
}
.footer1{
padding-top: 6rem;
}
.footer2{
display: flex;
align-items: center;
justify-content: center;
margin-top: 2rem;
}
.footer2 a{
text-decoration: none;
color: black;
margin-left: 2rem;
transition: .5s;
}
.footer2 a:hover{
transform: translate(0, -5px);
}
.footer3{
display: flex;
align-items: center;
justify-content: center;
margin: 3rem 0 0;
}
.footer3 a{
margin: 0 2rem;
text-decoration: none;
color: black;
font-size: 30px;
transition: .5s;
}
.footer3 a:hover{
transform: translate(0, -5px);
}
#media(max-width: 700px){
.footer1{
padding-top: 30px;
}
.footer3{
margin: 2rem 0 0;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.2/css/all.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/#fortawesome/fontawesome-free#6.1.2/css/fontawesome.min.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Titillium+Web&display=swap" rel="stylesheet">
<link href="css.css" rel="stylesheet">
</head>
<body>
<!------------------------------- nav ------------------------------->
<div class="wrapper">
<div class= "content-wrap">
<div class="background-container">
<nav>
<img src="assets/logo.png">
<div class="nav-links" id="navLinks">
<i class="fa-solid fa-xmark" onclick="hideMenu()"></i>
<ul>
<li>HOME</li>
<li>ABOUT</li>
<li>PROJECTS</li>
<li>WHAT I'VE BEEN UP TO</li>
</ul>
</div>
<i class="fa-solid fa-bars" onclick="showMenu()"></i>
</nav>
</div>
<!------------------------------- main content ------------------------------->
<main>
<h1 class="title">Projects</h1>
<div class="grid-ish">
<div class="spotify">
<h2>Spotify Playlist -> Youtube Downloader</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Esse ullam sequi, nam repellendus ab, repellat maiores. Saepe
voluptatem at asperiores obcaecati qui culpa, hic sint voluptatum
ad consequuntur voluptas dolorem?<br> <br>Lorem ipsum dolor sit amet,
consectetur adipisicing elit. Itaque, facere iste, eligendi ipsa rerum
voluptas officia ullam eius iusto eaque.</p>
</div>
<div class="discord">
<h2>Discord Bot</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Esse ullam sequi, nam repellendus ab, repellat maiores. Saepe
voluptatem at asperiores obcaecati qui culpa, hic sint voluptatum
ad consequuntur voluptas dolorem?Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Esse ullam sequi, nam repellendus ab, repellat maiores. Saepe
voluptatem at asperiores obcaecati qui culpa, hic sint voluptatum
ad consequuntur voluptas dolorem?</p>
</div>
<div class="tracker">
<h2>Financial Tracker</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Cupiditate
alias ducimus animi, voluptatem quaerat? Aliquam, fuga, distinctio! Modi
veritatis quam quisquam molestias eveniet temporibus incidunt dolorem
quaerat obcaecati tempora possimus, aperiam, qui.</p>
</div>
<div class="idk">
<h2>Haven't Decided</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quis
placeat, dolores maxime, assumenda aspernatur repellendus? Officiis
maxime obcaecati nisi maiores. ipsum dolor sit amet, consectetur
adipisicing elit. Eligendi</p>
</div>
</div>
</main>
</div>
<!------------------------------- footer ------------------------------->
<footer>
<div class= "footer-container">
<div class="footer">
<div class="footer1">
<h2>Luca Henderson</h2>
</div>
<div class="footer2">
Home
About
Projects
What I've Been Up To
</div>
<div class="footer3">
<i class="fab fa-linkedin"></i>
<i class="fab fa-github"></i>
<i class="fab fa-angellist"></i>
</div>
</div>
</div>
</footer>
</div>
<!--<-------------JavaScript for Toggle Menu------------>
<script>
var navLinks = document.getElementById("navLinks");
function showMenu(){
navLinks.style.right ="0";
}
function hideMenu(){
navLinks.style.right = "-200px";
}
</script>
</body>
</html>

alignment issue in media query

So am trying to align these cards I made using flexbox at a smaller screen size using media query but for some reason am having a bit of trouble aligning the items at the center of the screen when it shrinks down to match the media query am wondering why this occurs. I tried aligning them to the center but it doesnt work.
<section class="bg-lightcareml container">
<div class="container-section">
<h2 class="prod-items">Our Products</h2>
<div class="card-items">
<div class="card">
<img src="blackbird.jpg" alt="">
<div class="card-text">
<h2>CyberWare</h2>
<p>
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Ipsum perferendis iure asperiores
dicta quis vel fugiat, soluta nam laboriosam.
</p>
</div>
</div>
<div class="card">
<img src="blackbird.jpg" alt="">
<div class="card-text">
<h2>CyberWare</h2>
<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Sint tempore doloremque vero
placeat officiis eaque nisi velit rerum dolorums.</p>
</div>
</div>
<div class="card">
<img src="blackbird.jpg" alt="">
<div class="card-text">
<h2>CyberWare</h2>
<p>
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Veritatis nulla numquam in
provident deserunt! Cumque excepturi delectus
</p>
</div>
</div>
</div>
</div>
</section>
:root {
--clr-pr-200: #fceded;
--clr-pr-300: #bceeff;
--clr-pr-400: #0c0d0d;
--clr-pr-dr-: #ded9d9;
--clr-ctrl-100: #ffffff;
--clr-ntrl-900: #222C2A;
--ff-pr: 'Times New Roman', sans-serif;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
font-size: 62.2%;
font-family: Roboto, Arial, Helvetica, sans-serif;
}
body {
font-weight: 400;
font-size: 1.3175rem;
line-height: 1.6;
}
.bg-lightblue {
background-color: var(--clr-pr-300);
height: 12vh;
}
.container {
margin-inline: auto;
width: min(95%, 210rem);
}
/*card-section*/
.bg-lightcareml {
background-color: var(--clr-pr-400);
}
.container-section {
margin-top: 3rem;
min-height: 820px;
max-width: 100%;
margin-bottom: 4rem;
padding: 0.6rem;
}
.container-section>.prod-items {
text-align: center;
font-size: x-large;
font-family: var(--ff-pr);
}
.prod-items {
padding: 1.8rem 0 0 0;
color: var(--clr-pr-200);
}
.card-items {
display: flex;
justify-content: center;
flex-wrap: wrap;
gap: 2.5rem;
}
.card {
display: flex;
flex: 0 1 200px;
flex-direction: column;
}
.card .card-text {
display: flex;
flex-direction: column;
}
.card-text {
background: var(--clr-ctrl-100);
padding: 1.2rem;
margin-top: -6px;
}
#media (max-width:35rem) {
.container-section {
padding: 5rem 0;
display: flex;
flex-direction: row;
justify-content: center;
}
.card-items {
display: flex;
flex-direction: column;
margin-top: 1.1rem;
max-width: 200px;
}
}
h2,
p {
line-height: 1.4;
font-size: 1.666rem;
font-weight: 500;
}
h2 {
font-weight: bold;
font-size: 1.76rem;
}
.card-items h2 {
text-align: center;
}
.card-items p {
text-align: center;
max-width: 930px
}
.card img {
max-width: 300px;
aspect-ratio: 1.3 / 1;
width: 100%;
}
Will this help? I don't know how you wanted it to look, but I think I think it has a better base you can build on.
:root {
--clr-pr-200: #fceded;
--clr-pr-300: #bceeff;
--clr-pr-400: #0c0d0d;
--clr-pr-dr-: #ded9d9;
--clr-ctrl-100: #ffffff;
--clr-ntrl-900: #222C2A;
--ff-pr: 'Times New Roman', sans-serif;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
font-size: 62.2%;
font-family: Roboto, Arial, Helvetica, sans-serif;
}
body {
font-weight: 400;
font-size: 1.3175rem;
line-height: 1.6;
}
.bg-lightblue {
background-color: var(--clr-pr-300);
height: 12vh;
}
.container {
margin-inline: auto;
width: min(95%, 210rem);
}
/*card-section*/
.bg-lightcareml {
background-color: var(--clr-pr-400);
}
.container-section {
margin-top: 3rem;
min-height: 820px;
max-width: 100%;
margin-bottom: 4rem;
padding: 0.6rem;
}
.container-section>.prod-items {
text-align: center;
font-size: x-large;
font-family: var(--ff-pr);
}
.prod-items {
padding: 1.8rem 0 0 0;
color: var(--clr-pr-200);
}
.card-items {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.card {
display: flex;
flex-direction: column;
width: 300px;
}
.card .card-text {
display: flex;
flex-direction: column;
}
.card-text {
background: var(--clr-ctrl-100);
padding: 1.2rem;
margin-top: -6px;
}
#media screen and (min-width: 700px) {
.card-items {
flex-direction: row;
}
.card {
width: auto;
margin: 0 10px;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./index.css" />
<title>Document</title>
</head>
<body>
<section class="bg-lightcareml container">
<div class="container-section">
<h2 class="prod-items">Our Products</h2>
<div class="card-items">
<div class="card">
<img src="blackbird.jpg" alt="">
<div class="card-text">
<h2>CyberWare</h2>
<p>
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Ipsum perferendis iure asperiores
dicta quis vel fugiat, soluta nam laboriosam.
</p>
</div>
</div>
<div class="card">
<img src="blackbird.jpg" alt="">
<div class="card-text">
<h2>CyberWare</h2>
<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Sint tempore doloremque vero
placeat officiis eaque nisi velit rerum dolorums.</p>
</div>
</div>
<div class="card">
<img src="blackbird.jpg" alt="">
<div class="card-text">
<h2>CyberWare</h2>
<p>
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Veritatis nulla numquam in
provident deserunt! Cumque excepturi delectus
</p>
</div>
</div>
</div>
</div>
</section>
</body>
</html>
You just have to make 2 changes when on mobile
#media (max-width: 35rem)
.container-section {
flex-direction: column;
align-items: center;
}
and it would be ok

Position element at the bottom of container without flex or position absolute

I'm trying to make a component that uses both a background color for half of the component and
an image for the other half, with the image acting as an element with a margin. The problem I'm having is that I cannot use display flex to space elements correctly in the content area, it breaks the component with the current solution I'm using and I have no idea why.
I'm specifically trying to position .service__link at the bottom of .service__content. I've tried using paddings/margins to get it in place, but at smaller screen sizes it ends up overflowing out of the box.
*, *::before, *::after {
box-sizing: border-box;
}
* {
padding: 0;
margin: 0;
}
body {
min-height: 100vh;
font-family: Arial;
}
.service-container {
max-width: 1800px;
margin-inline: auto;
padding: 40px 15px;
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 1.5rem;
}
.service {
flex: 1 1 calc(33.3336% - 1.5rem);
display: inline-block;
position: relative;
background: #144088;
min-height: 325px;
border: 2px solid #144088;
color: white;
}
.service::before {
content: "";
float: right;
width: 100%;
height: 100%;
background: url(https://images.unsplash.com/photo-1645069258059-6f5a71256c4a?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2076&q=80) left center/150%;
shape-outside: polygon(79% 0, 100% 0, 100% 100%, 42% 100%);
clip-path: polygon(79% 0, 100% 0, 100% 100%, 42% 100%);
shape-margin: .3em;
}
.service::after {
content: "01";
position: absolute;
top: 0;
font-size: 60px;
font-weight: bold;
line-height: 1;
opacity: 25%;
}
.service__content {
padding: 3rem 0 1rem 1rem;
height: 100%;
}
.service__title {
font-size: 26px;
}
.service__description {
font-size: clamp(12px, 3vw + .25rem, 16px);
}
.service__title, .service__description {
margin-bottom: 1rem;
}
.service__link {
display: inline-flex;
justify-content: space-between;
align-items: center;
width: 35%;
}
.service__link a {
color: white;
}
.service__link img {
filter: brightness(0)invert(1);
}
#media screen and (max-width: 1200px) {
.service {
flex: 0 1 518px;
}
}
<body>
<div class="service-container">
<div class="service">
<div class="service__content">
<h4 class="service__title">Lorem</h4>
<p class="service__description">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Placeat doloremque molestiae eligendi voluptas veniam repellendus, aperiam tempora suscipit consectetur sint?</p>
<div class="service__link">
Link
<img src="https://img.icons8.com/ios/26/000000/image.png"/>
</div>
</div>
</div>
<div class="service">
<div class="service__content">
<h4 class="service__title">Lorem</h4>
<p class="service__description">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Placeat doloremque molestiae eligendi voluptas veniam repellendus, aperiam tempora suscipit consectetur sint?</p>
<div class="service__link">
Link
<img src="https://img.icons8.com/ios/26/000000/image.png"/>
</div>
</div>
</div>
<div class="service">
<div class="service__content">
<h4 class="service__title">Lorem</h4>
<p class="service__description">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Placeat doloremque molestiae eligendi voluptas veniam repellendus, aperiam tempora suscipit consectetur sint?</p>
<div class="service__link ">
Link
<img src="https://img.icons8.com/ios/26/000000/image.png"/>
</div>
</div>
</div>
</div>
</body>
What is going on when display: flex is added to .service__content?
Also, if anybody has a better idea of how to make this component in general I'd love to hear it.
Thanks!
I think you could use this:
position: absolute; bottom: 30px
to put it in the bottom part of the div.
If you set service__link to flex instead of inline flex and add margin-top auto it should stay on the bottom
you have to give position : relative for container
than for service__link position: absolute; left:10px; bottom:10px;
there will be no deterioration in smaller screen.
.service__content {
padding: 3rem 0 1rem 1rem;
height: 100%;
position: relative; // Added
}
.service__link {
display: inline-flex;
justify-content: space-between;
align-items: center;
width: 35%;
position: absolute; // Added
left:10px; // Added
bottom:10px; // Added
}
*, *::before, *::after {
box-sizing: border-box;
}
* {
padding: 0;
margin: 0;
}
body {
min-height: 100vh;
font-family: Arial;
}
.service-container {
max-width: 1800px;
margin-inline: auto;
padding: 40px 15px;
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 1.5rem;
}
.service {
flex: 1 1 calc(33.3336% - 1.5rem);
display: inline-block;
position: relative;
background: #144088;
min-height: 325px;
border: 2px solid #144088;
color: white;
}
.service::before {
content: "";
float: right;
width: 100%;
height: 100%;
background: url(https://images.unsplash.com/photo-1645069258059-6f5a71256c4a?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2076&q=80) left center/150%;
shape-outside: polygon(79% 0, 100% 0, 100% 100%, 42% 100%);
clip-path: polygon(79% 0, 100% 0, 100% 100%, 42% 100%);
shape-margin: .3em;
}
.service::after {
content: "01";
position: absolute;
top: 0;
font-size: 60px;
font-weight: bold;
line-height: 1;
opacity: 25%;
}
.service__content {
padding: 3rem 0 1rem 1rem;
height: 100%;
position:relative;
}
.service__title {
font-size: 26px;
}
.service__description {
font-size: clamp(12px, 3vw + .25rem, 16px);
}
.service__title, .service__description {
margin-bottom: 1rem;
}
.service__link {
display: inline-flex;
justify-content: space-between;
align-items: center;
width: 35%;
position:absolute;
left:10px;
bottom:10px;
}
.service__link a {
color: white;
}
.service__link img {
filter: brightness(0)invert(1);
}
#media screen and (max-width: 1200px) {
.service {
flex: 0 1 518px;
}
}
<body>
<div class="service-container">
<div class="service">
<div class="service__content">
<h4 class="service__title">Lorem</h4>
<p class="service__description">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Placeat doloremque molestiae eligendi voluptas veniam repellendus, aperiam tempora suscipit consectetur sint?</p>
<div class="service__link">
Link
<img src="https://img.icons8.com/ios/26/000000/image.png"/>
</div>
</div>
</div>
<div class="service">
<div class="service__content">
<h4 class="service__title">Lorem</h4>
<p class="service__description">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Placeat doloremque molestiae eligendi voluptas veniam repellendus, aperiam tempora suscipit consectetur sint?</p>
<div class="service__link">
Link
<img src="https://img.icons8.com/ios/26/000000/image.png"/>
</div>
</div>
</div>
<div class="service">
<div class="service__content">
<h4 class="service__title">Lorem</h4>
<p class="service__description">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Placeat doloremque molestiae eligendi voluptas veniam repellendus, aperiam tempora suscipit consectetur sint?</p>
<div class="service__link ">
Link
<img src="https://img.icons8.com/ios/26/000000/image.png"/>
</div>
</div>
</div>
</div>
</body>

Why my content won't clear this flex element?

In the snippet below, I have a slider, which works great. There's an h2 that is placed after the primary-content class. The content outside of the `.primary-content' class won't clear the container. I don't understand why.
(function () {
"use strict";
let slides = document.querySelectorAll(".testimonial__item"),
button = document.getElementById("button"),
arrows = document.querySelectorAll(".icon"),
carouselCount = 0,
scrollInterval,
interval = 5000;
arrows[0].addEventListener("click", function (e) {
e = e || window.event;
e.preventDefault();
carouselCount -= 100;
slider();
if (e.type !== "autoClick") {
clearInterval(scrollInterval);
scrollInterval = setInterval(interval);
}
});
arrows[1].addEventListener("click", sliderEvent);
function sliderEvent(e) {
e = e || window.event;
e.preventDefault();
carouselCount += 100;
slider();
}
function slider() {
switch (carouselCount) {
case -100:
carouselCount = 0;
break;
case 300:
carouselCount = 0;
break;
default:
break;
}
console.log(carouselCount);
for (var i = 0; i < slides.length; i += 1) {
slides[i].setAttribute(
"style",
"transform:translateX(-" + carouselCount + "%)"
);
}
}
// set timing of dispatch click events
scrollInterval = setInterval(interval);
})();
/* Duru Sans */
#import url("https://fonts.googleapis.com/css2?family=Duru+Sans&display=swap");
body {
box-sizing: border-box;
margin: 0;
padding: 0;
font-size: 16px;
font-family: "Duru Sans", sans-serif;
}
h2 {
padding: 5px;
background: fuchsia;
width: fit-content;
}
h4 {
font-family: "Lato", sans-serif;
font-size: 2em;
}
.img-fluid {
width: 100%;
height: auto;
}
.primary-content {
padding: 2em;
}
.testimonial__carousel {
width: 100%;
position: relative;
display: block;
flex-direction: column;
overflow-x: clip;
}
.testimonial__carousel--top {
display: flex;
flex-direction: column;
}
#media screen and (min-width: 576px) {
.testimonial__carousel--top {
flex-direction: row;
align-items: center;
justify-content: space-between;
}
}
#media screen and (min-width: 768px) {
.testimonial__carousel {
max-height: 320px;
}
}
.testimonial__icons {
display: flex;
justify-content: flex-start;
margin-top: 2rem;
margin-bottom: 2rem;
}
.testimonial__icons button.icon {
background: transparent;
border: 0;
display: flex;
align-items: center;
cursor: pointer;
padding: 0;
}
.testimonial__icons button.icon-left {
margin-right: 1.25rem;
}
.testimonial__icons button.icon img {
height: 25px;
width: 25px;
}
.testimonial__items {
flex: 1;
color: #000;
}
.testimonial__item {
width: 100%;
transition: transform 1s;
background: #f2f5f9;
display: flex;
flex-direction: column;
justify-content: center;
}
#media screen and (min-width: 576px) {
.testimonial__item {
flex-direction: row;
}
}
.testimonial__item.first {
left: 0;
position: absolute;
}
.testimonial__item.second {
left: 100%;
position: absolute;
}
.testimonial__item.third {
left: 200%;
position: absolute;
}
.testimonial__img {
min-width: 40%;
}
.testimonial__content {
background: #f2f5f9;
padding: 2.75rem 2.5rem 2.5rem;
display: flex;
flex-direction: column;
justify-content: space-between;
}
#media screen and (min-width: 768px) {
.testimonial__content {
padding: 3.5rem;
}
}
.testimonial__credits {
display: flex;
flex-direction: column;
margin-top: 2rem;
border-left: 4px solid #005fec;
padding-left: 0.75rem;
}
.testimonial__name {
margin-bottom: 0.5rem;
}
<div class="primary-content">
<h4>Testimonials</h4>
<div class="testimonial__carousel">
<div class="testimonial__carousel--top">
<h3>People love it here. See why</h3>
<div class="testimonial__icons">
<button class="icon icon-left">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/d/d9/Feather-arrows-arrow-left.svg/768px-Feather-arrows-arrow-left.svg.png" alt="">
</button>
<button class="icon icon-right">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/cf/Feather-arrows-arrow-right.svg/1200px-Feather-arrows-arrow-right.svg.png" alt="">
</button>
</div>
</div>
<div class="testimonial__items">
<div class="testimonial__item first">
<div class="testimonial__img">
<img class="img-fluid" src="https://nextivaweb.imgix.net/heroes/case-study/Case-Study-Conan-hero.jpg?w=336&h=412&auto=format&crop=focalpoint&fit=crop&fp-x=.75&fp-z=1.3&fp-y=.39" alt="">
</div>
<div class="testimonial__content">
<div class="testimonial__text">Lorem ipsum dolor sit amet consectetur adipisicing elit. Deleniti laboriosam fugiat perferendis blanditiis, dignissimos temporibus sunt aliquam sequi quia! Deleniti earum quibusdam dolorem accusantium ipsum?</div>
<div class="testimonial__credits">
<span class="testimonial__name kicker kicker--bold">Lorem, ipsum.</span>
<span class="testimonial__position kicker kicker--light">Lorem ipsum dolor sit amet,
Burbank,
CA</span>
</div>
</div>
</div>
<div class="testimonial__item second">
<div class="testimonial__img">
<img class="img-fluid" src="https://sandbox-uploads.imgix.net/u/1630477471-dd0cd5b16967417586c822d6dabcb995?w=336&h=412&auto=format&crop=focalpoint&fit=crop" alt="">
</div>
<div class="testimonial__content">
<div class="testimonial__text">Lorem ipsum dolor sit amet consectetur adipisicing elit. Deleniti laboriosam fugiat perferendis blanditiis, dignissimos temporibus sunt aliquam sequi quia! Deleniti earum quibusdam dolorem accusantium ipsum?</div>
<div class="testimonial__credits">
<span class="testimonial__name kicker kicker--bold">Lorem, ipsum.</span>
<span class="testimonial__position kicker kicker--light">Lorem ipsum dolor sit amet,
Burbank,
CA</span>
</div>
</div>
</div>
<div class="testimonial__item third">
<div class="testimonial__img">
<img class="img-fluid" src="https://sandbox-uploads.imgix.net/u/1630477587-e54d61f4eef5e36c72dccd1fc0463514?w=336&h=412&auto=format&crop=focalpoint&fit=crop" alt="">
</div>
<div class="testimonial__content">
<div class="testimonial__text">Lorem ipsum dolor sit amet consectetur adipisicing elit. Deleniti laboriosam fugiat perferendis blanditiis, dignissimos temporibus sunt aliquam sequi quia! Deleniti earum quibusdam dolorem accusantium ipsum?</div>
<div class="testimonial__credits">
<span class="testimonial__name kicker kicker--bold">Lorem, ipsum.</span>
<span class="testimonial__position kicker kicker--light">Lorem ipsum dolor sit amet,
Burbank,
CA</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="test-flex-parent">
<h2 class="flex-child">Hello</h2>
<h2 class="flex-child">World</h2>
</div>

How to properly format a bleeding image so that it appears in proper ratio

I have a container that is keeping the content to a max-width of 1200px and want to have a main image that is placed as the background of the .main_prize_section and can expand on bigger screens while staying within the proper aspect ratio. the main wrapper image is like a container for the main content, so it cant appear distorted.
here is the html code
<section class="main_prize_section">
<div class="container">
<div>
<div class="row">
<div class="flex_row">
<div class="col_1_2">
<div>
<h1>TEST HEADER</h1>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos quae quo fugit asperiores, aperiam perspiciatis dolores consectetur quam nemo, laudantium et doloribus officia voluptates eveniet optio ad ab quaerat natus!</p>
</div>
<div>
<h2>sub header</h2>
<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Corrupti accusantium molestiae id a quae pariatur? Sequi ipsum quos libero aspernatur tempore molestiae facere, porro, autem perferendis, atque aut earum reiciendis.</p>
</div>
</div>
<div class="col_1_2 main_prize_product"><img src="images/english/prize_images.png" alt="" width="100%"/></div>
</div>
</div>
</div>
</div>
</section>
here is the css code
.container {
max-width: 1200px;
margin: 0 auto;
}
.flex_col {
-webkit-flex-direction: column;
-moz-box-orient: vertical;
-moz-box-direction: normal;
flex-direction: column;
display: -webkit-flex;
display: -moz-box;
display: flex;
}
.flex_row {
display: -webkit-flex;
display: -moz-box;
display: flex;
}
.col_1_2 {
width: 50%;
}
.main_prize_section {
text-align: center;
background: url("../images/prize_background.png");
background-repeat: no-repeat;
background-size: 100%;
width: 100%;
background-position: 50% 50%;
text-align: center;
}
.main_prize_section img {
width: 50%;
margin: 0 auto;
}
.main_prize_section .flex_row {
padding: 2%;
}
.main_prize_section h1 {
color: pink;
font-size: 4rem;
font-weight: 700;
}
.main_prize_section h2 {
color: pink;
font-size: 2.5rem;
font-weight: 700;
}
.main_prize_section .col_1_2 div:nth-child(2) {
padding: 2%;
}
.main_prize_section p:nth-child(2) {
padding: 2%;
}
.main_prize_section p span:nth-child(1) {
color: gold;
}
.main_prize_section p span:nth-child(2) {
color: pink;
}
.main_prize_section p span:nth-child(3) {
color: red;
}
.main_prize_section p span:nth-child(4) {
color: blue;
}
the main wrapper image that bleeds out is 1366x800.
See if this helps you: https://codepen.io/panchroma/pen/jxxoqO
The important bit is the CSS lines 36 - 39
.main_prize_section {
...
background:url("../images/prize_background.png");
background-repeat: no-repeat;
background-size:cover; /* could also be background-size:contain; */
background-position:50% 50%; /* adjust to fit your design and the image */
}
For the background size, use either 'cover' or 'contain', and in combination with the background-position values, find a combination of settings that work for your specific design and image.
Good luck!