Related
I am trying to have my site set up like this:
I have problems with the borders and simply having the text to the right of the image as shown in the image.
h1 {
font-size: 50px;
text-align: center;
line-height: 20px;
}
h2 {
font-size: 35px;
margin-left: 400px;
}
h3 {
font-size: 35px;
margin-left: 350px;
}
p {
font-size: 20px;
width: 500px;
margin-left: 350px;
}
.sectionOne {
float: left;
}
.sectionTwo {
float: right;
}
.jb {
width: 45%;
border: 1px solid black;
padding: 10px;
box-sizing: border-box;
}
.ach {
display: inline-block;
width: 45%;
border: 1px solid black;
padding: 10px;
box-sizing: border-box;
}
img {
display: block;
width: 30%;
}
<h1>Joshua Eachus</h1>
<div class="jb">
<div class="sectionOne">
<img src="https://i.ibb.co/VLV0qfv/Wood-Floor-Texture-Seamless.jpg" alt="Joshua EAchus">
</div>
<div class="sectionTwo">
<h2>Job Experience</h2>
<h3>Menchies</h3>
<p class="menchies"> Between January 2020-November 2020 I was a team member at menchies, I would mainly greet customers, help them around the store if needed and cash them out with the cash register when ready. I also am constantly busy making sure every topping and yogurt
machine is filled up for the customers. I would usually be closing so I work 5 to 8 hour shifts every time. When closing I would put all the toppings away, clean the whole store completely and prep food for the next day.</p>
<h3>Walgreens</h3>
<p class="Walgreens"> I am currently working at Walgreens, which has been a great introduction into retail and has truly taught me many things. There is a diverse and large amount of tasks I do at Walgreens, one of the main tasks is running the photo department, where
I print many kinds of photos, create canvases and many more projects. Other tasks includes stocking, outdating, cleaning duties and counting registers.</p>
</div>
</div>
<div class="ach">
<h3>Achievements</h3>
<img src="https://i.ibb.co/VLV0qfv/Wood-Floor-Texture-Seamless.jpg" alt="PTK">
<p>I am a member of Phi Theta Kappa. Founded on November 19, 1918 Phi Theta Kappa is the world’s largest organization specifically devoted to recognizing the achievements of honor students at 2-year institutions. Currently, PTK has approximately 3 million
members globally.</p>
</div>
The best way to achieve that layout would be to use CSS grid. I am using a grid layout and then nested divs for each section.
.title {
text-align: center;
padding: 2rem 0;
}
.grid-container {
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-gap: 2rem;
padding: 0 2rem;
}
img {
max-width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
.jb,
.ach {
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-gap: 1rem;
}
.ach * {
grid-column: 1 / -1;
text-align: center;
}
.ach .sectionOne img {
margin: 0 auto;
}
#media screen and (max-width: 768px) {
.grid-container, .jb, .ach {
grid-template-columns: 1fr;
}
.sectionOne {
grid-column: 1 / -1;
}
}
<h1 class="title">Joshua Eachus</h1>
<div class="grid-container">
<div class="jb">
<div class="sectionOne">
<img src="https://picsum.photos/500/300" alt="Joshua EAchus">
</div>
<div class="sectionTwo">
<h2>Job Experience</h2>
<h3>Menchies</h3>
<p class="menchies"> Between January 2020-November 2020 I was a team member at menchies, I would mainly greet customers, help them around the store if needed and cash them out with the cash register when ready. I also am constantly busy making sure every topping and yogurt
machine is filled up for the customers. I would usually be closing so I work 5 to 8 hour shifts every time. When closing I would put all the toppings away, clean the whole store completely and prep food for the next day.</p>
<h3>Walgreens</h3>
<p class="Walgreens"> I am currently working at Walgreens, which has been a great introduction into retail and has truly taught me many things. There is a diverse and large amount of tasks I do at Walgreens, one of the main tasks is running the photo department, where
I print many kinds of photos, create canvases and many more projects. Other tasks includes stocking, outdating, cleaning duties and counting registers.</p>
</div>
</div>
<div class="ach">
<h3>Achievements</h3>
<div class="sectionOne">
<img src="https://picsum.photos/500/300" alt="PTK">
</div>
<div class="sectionTwo">
<p>I am a member of Phi Theta Kappa. Founded on November 19, 1918 Phi Theta Kappa is the world’s largest organization specifically devoted to recognizing the achievements of honor students at 2-year institutions. Currently, PTK has approximately 3 million
members globally.</p>
</div>
</div>
</div>
First, it is a loop in React and assumed as a mobile version.
Within each loop of DIV, it will have a photo(150*150px) on the left-hand side.
On the photo's right-hand side, it will have 3 div and each of the div will have a p (name, car and salary). At the bottom, it will have a line and its length will be the same as the parent div.
One special is that the pof car will have many words, when the width of the phone is not enough, it will go to the next line. If it is still not enough, it will become Tesla, Honda, BMW,...
it is the Sample Image
I really try many methods(float, position,...), but I still cant deal with it,
Here is the HTML part (using React)
<div className='loop'>
<img className='image' src={value.image}></img>
<div>
<p className='title'>{value.name}</p>
</div>
<div class>
<p className='car'>Tesla, Honda, BMW, Porsch,Mitsubishi, Mazda, Toyota, Jaguar, KIA </p>
</div>
<div>
<p>{value.salary}</p>
</div>
<div className='linebreak'></div>
</div>
Try with grid :
.loop {
display: grid;
grid-template-columns: auto 1fr;
align-items: center;
column-gap: .5em;
width: 400px
}
.image {
grid-row: span 3;
}
.linebreak {
margin-top: .5em;
grid-column: span 2;
border: 2px solid #4f86f7;
}
.loop p, img {
border: 2px solid #777696;
margin: 0;
}
.title {
align-self: start;
}
.salary {
align-self: end;
}
<div class='loop'>
<img class='image' src="https://picsum.photos/100" />
<p class='title'>name</p>
<p class='car'>Tesla, Honda, BMW, Porsch,Mitsubishi, Mazda, Toyota, Jaguar, KIA </p>
<p class='salary'>salary</p>
<div class='linebreak'></div>
</div>
This is a simple used automobile sales platform for a dealer who doesn't want a lot of interactivity, just a listing of the vehicles and prices in a visual manner similar to a print magazine (click on Run Code Snippet and View Full page to see it as it looks currently):
body {
font-family: Helvetica, sans-serif;
}
header, footer {
background-color: #7690AC;
color: #FFFFFF;
padding: 20px;
padding-bottom: 20px;
}
.content {
padding: 10px;
margin-bottom: 10px;
margin-left: 20px;
}
.grid {
margin-bottom: 20px;
}
.grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
grid-gap: 20px;
align-items: center;
}
.grid > article {
border: 1px solid #333;
box-shadow: 2px 2px 6px 0px rgba(0,0,0,0.3);
min-height: 25em;
top: -10px;
}
.grid > article img {
max-width: 100%;
margin-bottom: 12px;
}
.text {
font-size: 1em;
transform: scaleX(1.2) scaleY(1);
margin-left: 25px;
width: 270px;
}
.text {
padding: 0 10px 20px;
}
.text > button {
background: gray;
border: 0;
color: white;
padding: 10px;
width: 100%;
}
h3.price {
text-align: center;
}
.cards {
grid-template-columns: repeat(2, 1fr);
border-collapse: collapse;
max-width: 1200px;
margin: 0 auto;
display: grid;
grid-gap: 1rem;
}
.card {
background-color: dodgerblue;
color: white;
padding: 1rem;
height: 4rem;
}
p.address, p.phoneno {
font-size: 18px;
font-weight: 900;
line-height: 12px;
}
☎:before {
font-size: 14px;
}
<header>
<h1>YOURMOTORHOMES</h1>
<h2>Axtley Road, Penderton XX1 1XA</h2>
<h2>01634 00000</h2>
</header>
<div class="content">
<p>Welcome to YourMotorhomes!</p>
</div>
<main class="grid">
<article>
<img src="https://i.imgur.com/PApYyjj.jpg" alt="Elddis Autoquest">
<div class="text">
<p><b>2020 70 ELDDIS AUTOQUEST 194 2.2 HDi 140 LOW PROFILE MOTORHOME PEUGEOT BOXER CHASSIS</b>
4 berth, end washroom, white, 100 litre fresh water, 70 litre waste water, 3 ring hob, OG cooker, 155 litre fridge, 600 miles, almost as new, <b class="price">£44895</b></p>
</div>
</article>
<article>
<img src="https://i.imgur.com/h7Cujxy.jpg" alt="Dethleffs Esprit"><em>Image for illustration purposes only</em>
<div class="text">
<p><b>2014 64 DETHLEFFS i6810 ESPRIT 2.3 MULTIJET 130 A-CLASS FIAT DUCATO MOTORHOME</b>
4 berth, 4 belted seats A-class motorhome finished in Diamodn White, fixed single bed layout, 3 ring cooker, fully loaded spec, 28,000 miles <b class="price">£62115</b></p>
</div>
</article>
<article>
<img src="https://i.imgur.com/TfuaqVa.jpg" alt="Burstner Aviano">
<div class="text">
<p><b>2009 59 BURSTNER AVIANO i725 3.0 MULTIJET 180 FIAT TD</b>
4 berth, gold, island bed layout, 3 ring hob, 150 litre fridge, 7.45m length, 2.30m width <b class="price">£44995</b></p>
</div>
</article>
<article>
<img src="https://i.imgur.com/oUWFVub.jpg" alt="Burstner Nexxo">
<div class="text">
<p><b>2009 58 BURSTNER NEXXO FAMILY A645 2.2 TDCi</b>
6 berth, 6 belted seats, end bedroom, blue, Layout - Over Cab Double, Centre Dinette Double, Rear Bunk beds, 2 Owners from New, Good Service History, Cab Air Conditioning, Gaslow Refillable LPG System, Truma Blown Air Combination Boiler, HPI Clear, Roof Rails, Large Garage - if not using bottom bunk, Awning,MOT 17/12/2021, 11 Service Stamps in the book, Last Damp check 01/21, GVW 3500kg, Length 6.56m, Width 2.30m, Height 3.0m, only 20,747 miles, registered 30/01/2009, MoT due in Oct' 21. DUE THIS WEEK. A GREAT EXAMPLE OF THIS BURSTNER MOTORHOME, MUST BE SEEN NOW, YOU WILL NOT FIND BETTER
<b class="price">£35000</b></p>
</div>
</article>
</main>
<footer>
content
</footer>
Functionally, it works, but I want to try and achieve three things; the within grid being all the same size, and also the images being the same size within the article (I've got it at max-width:100%) so it's not creating uneven sizes (if you view the design at full screen) and preventing text overflow by auto-resizing the font if there's a lot of text without needing a scrollbar or overflow: hidden; in the CSS.
I would be grateful if anyone can help, as this template's working, not quite production-ready, but it's getting there slowly.
Try this -
1. Remove transform property form .text class and
2. Remove align-items from .grid class.
.text {
font-size: 1em;
/* transform: scaleX(1.2) scaleY(1); */ // Comment it.
margin-left: 25px;
width: 270px;
}
.grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
grid-gap: 20px;
/* align-items: center; */ //Comment it.
}
The given code arranges the articles in a grid which adjusts to the viewport width OK but these things are required:
The height of each article should be the same
The height of each image should be the same
The text should have font-size adjusted so that it always fits within the article size
Taking each requirement in turn:
Set the height of article to something. It depends on what you think would be sensible bearing in mind the maximum amount of text a van may require - to ensure its text will still be readable. The snippet below sets it at 30em (based on the code in the question having a minimum height of 25em)
Although we want the height of each img to be the same, say a % of the article height, we need to ensure that the whole of the img is always viewable, without distortion or cropping. This snippet changes the HTML so that the img element becomes a div with fixed dimensions and the image is used as a background, centered both horizontally and vertically and with size contain. (see below for alternative).
Altering the font size I think requires Javascript. This snippet looks at the height of the text div and if it's too tall alters the font size until it fits. You may want to put a different limit on it so that it is always readable, even if that means occasionally the user having to scroll.
const articles = document.querySelectorAll('.grid > article');
articles.forEach(article => {
const articleH = article.offsetHeight;
let h = article.querySelector('.text').offsetHeight;
var fontSize = 0.9;
while (h > articleH/2) {//NOTE assumes the img is 50% alter if it is something else
article.querySelector('.text').style.fontSize = fontSize + 'em';
h = article.querySelector('.text').offsetHeight;
if (fontSize <= 0.2) break;
fontSize = fontSize - 0.05;
}
});
body {
font-family: Helvetica, sans-serif;
width: 100vw;
}
header, footer {
background-color: #7690AC;
color: #FFFFFF;
padding: 20px;
padding-bottom: 20px;
}
.content {
padding: 10px;
margin-bottom: 10px;
margin-left: 20px;
}
.grid {
margin-bottom: 20px;
}
.grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
grid-gap: 20px;
align-items: center;
}
.grid > article {
border: 1px solid #333;
box-shadow: 2px 2px 6px 0px rgba(0,0,0,0.3);
/* min-height: 25em; */
height: 30em; /* ADDED */
top: -10px;
}
.grid > article .img {
width: 100%;
height: 50%;
background-size: contain;
background-position: center center;
background-repeat: no-repeat no-repeat;
margin-bottom: 12px;
}
.text {
font-size: 1em;
/*transform: scaleX(1.2) scaleY(1);*/
margin-left: 25px;
width: 270px;
}
.text {
padding: 0 10px 20px;
}
.text > button {
background: gray;
border: 0;
color: white;
padding: 10px;
width: 100%;
}
h3.price {
text-align: center;
}
.cards {
grid-template-columns: repeat(2, 1fr);
border-collapse: collapse;
max-width: 1200px;
margin: 0 auto;
display: grid;
grid-gap: 1rem;
}
.card {
background-color: dodgerblue;
color: white;
padding: 1rem;
height: 4rem;
}
p.address, p.phoneno {
font-size: 18px;
font-weight: 900;
line-height: 12px;
}
☎:before {
font-size: 14px;
}
<header>
<h1>YOURMOTORHOMES</h1>
<h2>Axtley Road, Penderton XX1 1XA</h2>
<h2>01634 00000</h2>
</header>
<div class="content">
<p>Welcome to YourMotorhomes!</p>
</div>
<main class="grid">
<article>
<div class="img" style="background-image: url(https://i.imgur.com/PApYyjj.jpg)" alt="Elddis Autoquest"></div>
<div class="text">
<p><b>2020 70 ELDDIS AUTOQUEST 194 2.2 HDi 140 LOW PROFILE MOTORHOME PEUGEOT BOXER CHASSIS</b>
4 berth, end washroom, white, 100 litre fresh water, 70 litre waste water, 3 ring hob, OG cooker, 155 litre fridge, 600 miles, almost as new, <b class="price">£44895</b></p>
</div>
</article>
<article>
<div class="img" style="background-image: url( https://i.imgur.com/h7Cujxy.jpg" alt="Dethleffs Esprit)"></div><em>Image for illustration purposes only</em>
<div class="text">
<p><b>2014 64 DETHLEFFS i6810 ESPRIT 2.3 MULTIJET 130 A-CLASS FIAT DUCATO MOTORHOME</b>
4 berth, 4 belted seats A-class motorhome finished in Diamodn White, fixed single bed layout, 3 ring cooker, fully loaded spec, 28,000 miles <b class="price">£62115</b></p>
</div>
</article>
<article>
<div class="img" style="background-image: url(https://i.imgur.com/TfuaqVa.jpg)" alt="Burstner Aviano"></div>
<div class="text">
<p><b>2009 59 BURSTNER AVIANO i725 3.0 MULTIJET 180 FIAT TD</b>
4 berth, gold, island bed layout, 3 ring hob, 150 litre fridge, 7.45m length, 2.30m width <b class="price">£44995</b></p>
</div>
</article>
<article>
<div class="img" style="background-image: url(https://i.imgur.com/oUWFVub.jpg);" alt="Burstner Nexxo"></div>
<div class="text">
<p><b>2009 58 BURSTNER NEXXO FAMILY A645 2.2 TDCi</b>
6 berth, 6 belted seats, end bedroom, blue, Layout - Over Cab Double, Centre Dinette Double, Rear Bunk beds, 2 Owners from New, Good Service History, Cab Air Conditioning, Gaslow Refillable LPG System, Truma Blown Air Combination Boiler, HPI Clear, Roof Rails, Large Garage - if not using bottom bunk, Awning,MOT 17/12/2021, 11 Service Stamps in the book, Last Damp check 01/21, GVW 3500kg, Length 6.56m, Width 2.30m, Height 3.0m, only 20,747 miles, registered 30/01/2009, MoT due in Oct' 21. DUE THIS WEEK. A GREAT EXAMPLE OF THIS BURSTNER MOTORHOME, MUST BE SEEN NOW, YOU WILL NOT FIND BETTER
<b class="price">£35000</b></p>
</div>
</article>
</main>
<footer>
content
</footer>
An alternative to contain on the background size could be cover - if you were absolutely sure that the motor was central in each image and the aspect ratio such that it would fit OK. This runs a risk that not all the van will show though, but it gives a more consistent solid look to the top part of the article.
What I want to do is make my sidebar cards be on the right and not the left. I've tried to use the display: grid; and that didn't work. I've tried to use the left: 0; and right: 0; in css. Nothing is working for me. My full code is at github.com.
Please ingnore the colors, I tried to draw it in google drawings so it's not good.
This is how it is:
And this is how I want it to look:
You could use a grid like this. For detail explanations check here
*,
:before,
:after {
box-sizing: border-box;
}
body {
display: grid;
grid-gap: 10px;
grid-template-columns: 60% 40%;
grid-template-areas: "header header" "content cards";
width: 100%;
}
#header {
grid-area: header;
}
#content {
grid-area: content;
}
#cards {
grid-area: cards;
}
<h3 id="header">Welcome to my GitHub Pages website this is where you can learn about me, find my games, and suggest ideas for anything!</h3>
<div id="content">
</div>
<div id="cards" class="cards">
<div id="project1" class="project-card">
<h1>
Web Designer Tycoon
</h1>
<p>This is a idle tycoon like game where you have to make money by making web programs. People buy your web programs for money. If you get better at coding (in the game) then you will get more money for each program you make. Itis currently in the BETA
stage and it will get released after lots of testing and a couple more changes. Thank you for your patience. <span onclick="window.location.href = 'https://codepen.io/hacker19374/project/full/Zyraey/'">Click me to go to Web Designer Tycoon</span></p>
</div>
<div id="project2" class="project-card">
<h1>
Burger Clicker
</h1>
<p>This game is a little bit different. It is a clicker game where you clic and click and click over and over to try to get the most money you can and you can use that money to buy</p>
</div>
</div>
There are multiple ways to achieve this. But since you are using css grid do the following:
Add an extra class of project-card__1 and project-card__2 to the cards and then specify the grid-template-columns in your css.
See the demo below
p {
background-color: #179595;
width: auto;
}
.project-card {
margin: 5px;
width: 25%;
border: 4px solid #00688b;
background-color: #008b8b;
height: 354.33px;
margin-bottom: 50px;
margin-right: 50px;
}
h1 {
text-align: center;
padding-top: 5px;
}
body {
background-image: linear-gradient(270deg, #8b0046, #8b008b);
height: 100vh;
}
span {
cursor: ;
}
.cards {
display: grid;
grid-template-columns: repeat(6, 1fr);
right: 0;
}
.project-card__1 {
grid-column: 5 / 7;
grid-row: 1;
width: 100%;
}
.project-card__2 {
grid-column: 5 / 7;
grid-row: 2;
width: 100%;
}
<h3>
Welcome to my GitHub Pages website this is where you can learn about me,
find my games, and suggest ideas for anything!
</h3>
<div id="cards" class="cards">
<div id="project1" class="project-card project-card__1">
<h1>Web Designer Tycoon</h1>
<p>
This is a idle tycoon like game where you have to make money by making
web programs. People buy your web programs for money. If you get
better at coding (in the game) then you will get more money for each
program you make. Itis currently in the BETA stage and it will get
released after lots of testing and a couple more changes. Thank you
for your patience.
<span
onclick="window.location.href = 'https://codepen.io/hacker19374/project/full/Zyraey/'"
>Click me to go to Web Designer Tycoon</span
>
</p>
</div>
<div id="project2" class="project-card project-card__2">
<h1>Burger Clicker</h1>
<p>
This game is a little bit different. It is a clicker game where you
clic and click and click over and over to try to get the most money
you can and you can use that money to buy
</p>
</div>
</div>
I'm trying to assemble this webpage with the format of
name picture info
name picture info
name picture info
name picture info
Within the main part of the code.
When ever i activate the grid it automatically places the element in
Name 4 times side by side
pic
info
And I'm unable to change the position.
Here is the HTML code:
.head {
font-size: 100px;
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
font-weight: bold;
padding: 25px 50px 25px;
background-color: orange;
color: blue;
text-shadow: white 5px 5px 5px;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: blue;
}
li {
float: left;
}
li a {
display: block;
color: orange;
text-align: center;
padding: 14px 20px;
}
li a:hover:not(.active) {
background-color: rgb(255, 255, 255);
}
.active {
background-color: white;
}
img {
border: 1px solid rgb(105, 105, 105);
height: 200px;
padding: 10px;
width: 300px;
}
img:hover {
box-shadow: 0 0 2px 1px rgba(186, 0, 177, 0.5);
}
.mainweb {
display: grid;
grid-template-columns: auto auto auto;
grid-template-rows: auto auto auto auto;
grid-gap: 10px;
padding: 10px;
background-color: orange;
}
.mainweb .name {
font-weight: bold;
font-size: 25px;
}
.footer {
text-align: center;
background-color: blue;
color: white;
}
#Sasuke.name {
grid-column: 1 / 2;
grid-row: 2 / 3;
}
#Sasuke .pic {
grid-row: 2 / 3;
grid-column: 2 / 3;
}
#Sasuke .info {
grid-row: 2 / 3;
grid-column: 3 / 4;
}
.Kakashi .name {
grid-column: ;
grid-row: 3 / 4;
}
.Kakashi .pic {
grid-row: 3 / 4;
grid-column: ;
}
.Kakashi .info {
grid-row: 3 / 4;
grid-column: ;
}
.Gaara .name {
grid-column: ;
grid-row: 4 / 5;
}
.Gaara .pic {
grid-row: 4 / 5;
grid-column: ;
}
.footer {
text-align: center;
}
<link rel="stylesheet" type="text/css" href="css.css">
<div class="head">
<header>Naruto Wiki</header>
</div>
<div class="menu">
<ul>
<li><a class="active" href="#home">Home</a></li>
<li>About</li>
<li>Donate</li>
<li>Contact Us</li>
</ul>
</div>
<div class="container">
<div class="mainweb">
<div id="Naruto">
<p class="name">Naruto Uzamaki</p>
<a href="/Graphics/Naruto.png">
<img class="pic" src="/Graphics/Naruto.png" alt="Naruto">
</a>
<p class="info">
Naruto Uzumaki (うずまきナルト, Uzumaki Naruto) is a shinobi of Konohagakure's Uzumaki clan. He became the jinchūriki of the Nine-Tails on the day of his birth — a fate that caused him to be shunned by most of Konoha throughout his childhood. After joining Team
Kakashi, Naruto worked hard to gain the village's acknowledgement all the while chasing his dream to become Hokage. In the following years, through many hardships and ordeals, he became a capable ninja regarded as a hero both by the villagers,
and soon after, the rest of the world, becoming known as the Hero of the Hidden Leaf (木ノ葉隠れの英雄, Konohagakure no Eiyū, Literally meaning: Hero of the Hidden Tree Leaves). He soon proved to be one of the main factors in winning the Fourth Shinobi
World War, leading him to achieve his dream and become the village's Seventh Hokage (七代目火影, Nanadaime Hokage, Literally meaning: Seventh Fire Shadow).
</p>
</div>
<div id="Sasuke">
<p class="name">Sasuke Uchiha</p>
<a href="/Graphics/Sasuke.png">
<img id src="/Graphics/Sasuke.png" alt="Sasuke">
</a>
<p class="info">
Sasuke Uchiha (うちはサスケ, Uchiha Sasuke) is one of the last surviving members of Konohagakure's Uchiha clan. After his older brother, Itachi, slaughtered their clan, Sasuke made it his mission in life to avenge them by killing Itachi. He is added to Team
7 upon becoming a ninja and, through competition with his rival and best friend, Naruto Uzumaki, Sasuke starts developing his skills. Dissatisfied with his progress, he defects from Konoha so that he can acquire the strength needed to exact his
revenge. His years of seeking vengeance and his actions that followed become increasingly demanding, irrational and isolates him from others, leading him to be branded as an international criminal. After learning the truth of his brother's sacrifice,
later proving instrumental in ending the Fourth Shinobi World War, and being happily redeemed by Naruto, Sasuke decides to return to Konoha and dedicate his life to help protect the village and its inhabitants, becoming referred to as the "Supporting
Kage" (支う影, Sasaukage, Literally meaning: Supporting Shadow).
</p>
</div>
<div id="Kakashi">
<p class="name">Kakashi Hatake</p>
<a href="/Graphics/Kakashi.jpg">
<img src="/Graphics/Kakashi.jpg" alt="Kakashi">
</a>
<p class="info">
Kakashi Hatake (はたけカカシ, Hatake Kakashi) is a shinobi of Konohagakure's Hatake clan. Famed as Kakashi of the Sharingan (写輪眼のカカシ, Sharingan no Kakashi), he is one of Konoha's most talented ninja; regularly looked to for advice and leadership despite his
personal dislike of responsibility. To his students on Team 7, Kakashi teaches the importance of teamwork, a lesson he received, along with the Sharingan, from his childhood friend, Obito Uchiha. After the Fourth Shinobi World War, Kakashi becomes
Konoha's Sixth Hokage (六代目火影, Rokudaime Hokage, Literally meaning: Sixth Fire Shadow).
</p>
</div>
<div id="Gaara">
<p class="name">Gaara</p>
<a href="/Graphics/Gaara.png">
<img src="/Graphics/Gaara.png" alt="Gaara">
</a>
<p class="info">
Gaara (我愛羅) is a shinobi of Sunagakure. He was made the jinchūriki of the One-Tailed Shukaku before he was born, causing the villagers of Suna to fear him as a monster. With nobody to connect to, Gaara grew up hating the world and looking out only for
himself, giving his life meaning by killing anyone he came across. After being defeated by Naruto Uzumaki — a jinchūriki like himself who found strength in his friendships — Gaara starts emulating him. He becomes Suna's Fifth Kazekage (五代目風影,
Godaime Kazekage, Literally meaning: Fifth Wind Shadow) so that he can protect the village and all those who live there, dispelling the fears he cast on the villagers.
</p>
</div>
</div>
</div>
<div class="footer">
All information has been provided by https://naruto.fandom.com/wiki/Narutopedia Naruto Wiki | 2020
</div>
Right now, your grid only apply on the child elements of your .mainweb class.
So only
<div id="naruto">..</div>
<div id="Sasuke">..</div>
<div id="Kakashi">..</div>
<div id="Gaara">..</div>
what you can do is to apply your grid on each inner children and making each children just display: block if you want them one below the other.
If you want to keep the display: grid
then you can make you css like
Change your .mainweb by .mainweb>div to apply to all children
.mainweb>div {
display: grid;
grid-template-columns: auto auto auto;
grid-template-rows: auto;
grid-gap: 10px;
padding: 10px;
background-color: orange;
}
Or other solution is simply by using display: flex
it will keep your content more responsive.
.mainweb>div {
display: flex;
align-items: center;
justify-content: center;
padding: 10px;
background-color: orange;
}
Change html like this:
<div id="Naruto">
<div class="leftSection">
<p class="name">Naruto Uzamaki</p>
<a href="/Graphics/Naruto.png">
<img class="pic" src="/Graphics/Naruto.png" alt="Naruto">
</a>
</div>
<p class="info">
Naruto Uzumaki (うずまきナルト, Uzumaki Naruto) is a shinobi of Konohagakure's Uzumaki clan. He became the jinchūriki of the Nine-Tails
on the day of his birth — a fate that caused him to be shunned by most of Konoha throughout his childhood. After
joining Team Kakashi, Naruto worked hard to gain the village's acknowledgement all the while chasing his dream
to become Hokage. In the following years, through many hardships and ordeals, he became a capable ninja regarded
as a hero both by the villagers, and soon after, the rest of the world, becoming known as the Hero of the Hidden
Leaf (木ノ葉隠れの英雄, Konohagakure no Eiyū, Literally meaning: Hero of the Hidden Tree Leaves). He soon proved to be
one of the main factors in winning the Fourth Shinobi World War, leading him to achieve his dream and become
the village's Seventh Hokage (七代目火影, Nanadaime Hokage, Literally meaning: Seventh Fire Shadow).
</p>
</div>
And add css :
.leftSection{
width: 25%;
float: left;
}
.mainweb .name {
font-weight: bold;
font-size: 25px;
display: inline;
}
p.info{
width: 70%;
float: right;
}