So, I’m trying to change a part of my website, and i can’t get it to work. The css part of the code is this:
/*new timeline*/
:root {
scroll-behavior: smooth;
}
* {
margin: 10% 0;
padding: 1% 0;
box-sizing: content-box;
width: 50%;
}
body {
display: block;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: rgb(170, 230, 189);
}
header {
display: flex;
flex-direction: column;
align-items: center;
row-gap: 5%;
margin-top: 5%;
}
header h1 {
background-color: #fff;
padding: 1% 0;
border-radius: 50% 20% / 10% 40%;
color: green;
font-size: 1.5rem;
}
header p {
font-size: 1.25rem;
}
.main-container {
margin-top: 5%;
margin-bottom: 5%;
margin-left: 5%;
margin-right: 5%;
width: 100%;
display: inline-block;
flex-direction: column;
align-items: center;
}
.line {
position: relative;
left: 50%;
height:100%;
width: 80%;
display: flex;
align-items: center;
justify-content: center;
border-radius: 10%;
transform: translateX(-5%);
background-color: blue;
}
.line a {
text-decoration: none;
display: flex;
align-items: center;
justify-content: center;
position: relative;
bottom: 0;
width: 80%;
height: 80%;
font-weight: bold;
color: rgb(55, 131, 65);
background-color: #fff;
border-radius: 50%;
cursor: pointer;
overflow: auto;
}
.card {
font-size: .8rem;
width: 200px;
height: 150px;
border-radius: 10px;
background-color: white;
margin-bottom: 10px;
}
.left {
position: relative;
left: -10%;
right: 10%;
}
.right {
position: relative;
left: 10%;
}
.left::after,
.right::after {
content: '';
position: relative;
width: 80%;
height: 80%;
background-color: rgb(18, 113, 48);
border-radius: 0px 10px;
transform: rotate(-45deg);
z-index: -1;
}
.left::after {
top: 80%;
right: -80%;
}
.right::after {
top: 80%;
left: -80%;
}
.card h1 {
padding: 80%;
display: flex;
justify-content: center;
border-radius: 0 0 0 0;
color: white;
background-color: rgb(18, 113, 48);
}
.card p {
padding: 80%;
}
.thumbnail {
position: relative;
top: 0;
width: 80%;
height: 80%;
border-radius: 80%;
overflow: hidden;
}
.thumbnail img {
width: 100%;
height: 100%;
}
.left .thumbnail {
left: 80%;
}
.right .thumbnail {
right: 80%;
}
@media screen and (max-width:790px) {
body {
text-align: center;
padding: 0 10%x;
}
.main-container {
width: auto;
}
.line {
height: 80%;
}
.card {
top: 80%;
margin-bottom: 80%;
}
.left::after,
.right::after {
visibility: hidden;
}
.left {
left: auto;
}
.right {
left: auto;
}
.left .thumbnail {
top: -80%;
left: 80%;
}
.right .thumbnail {
top: -80%;
left: 80%;
}
}
What I’m aiming at, is to get the content of the page always centered, and at the same time adapting to browser size, page size, or device type. I have other pages on my site, and they all work fine, so it has to be something with this part of the code.
Is there something I have to change or to add, in order to get this to work as I want it to?