RHH
Coder
The attached screenshot is done with CSS grids and HTML. It gets 99% of the way to my final goal. Fixing the inter-box spacing and centering text in the Name box will get it the rest of the way. I don't know how to center the text in the first row where Name appears underlined in red; and I want to be able to set the font size. Text-align doesn't work for me nor does justify-content nor does font-size. In the screenshot attached, I drew green rectangles around areas that I want to shrink but cannot figure out how. I've tried margins and setting gaps to no avail.
My code is not pretty and could probably be improved in countless ways; however, it is what I have achieved through reading and trial and error (a lot of error
). You won't hurt my feelings by criticizing it. Is it possible to control those gaps I highlighted? . . . to center and change the font size in the top row? If I'm trying to do the impossible with CSS Grid, I'd like to know. OTOH if it can be done, I want to learn how.
I've been through the W3c tutorials numerous times without finding my answers. I've also searched for articles and YTs without finding one that addresses my issues.
Any help will be greatly appreciated.
HTML Code
If I failed to post the code correctly, please tell me what I did wrong so I don't make that mistake again.
TIA
My code is not pretty and could probably be improved in countless ways; however, it is what I have achieved through reading and trial and error (a lot of error
I've been through the W3c tutorials numerous times without finding my answers. I've also searched for articles and YTs without finding one that addresses my issues.
Any help will be greatly appreciated.
CSS:
.item1
{
grid-area: name;
width: 500px;
height: 40px;
margin-top: 10px;
margin-left: auto;
margin-right: auto;
margin-bottom: 10px;
border-style:ridge;
border-width: 5px;
border-radius:10px;
}
.item2
{
grid-area: photo;
width: 245px;
height: 225px;
margin-left: 70px;
border-style:ridge;
border-width: 2.5px;
border-radius: 5px;
}
.item3
{
grid-area: birth;
width: 75px;
height: 65px;
border-style:ridge;
border-width: 2.5px;
border-radius:5px
}
.item4
{
grid-area: birth-details;
width: 280px;
height: 65px;
border-style:ridge;
border-width: 2.5px;
border-radius: 5px
}
.item5
{
grid-area: marriage;
width: 75px;
height: 65px;
border-style:ridge;
border-width: 2.5px;
border-radius: 5px
}
.item6
{
grid-area: marriage-details;
width: 280px;
height: 65px;
border-style:ridge;
border-width: 2.5px;
border-radius: 5px
}
.item7
{
grid-area: death;
width: 75px;
height: 65px;
border-style:ridge;
border-width: 2.5px;
border-radius: 5px
}
.item8
{
grid-area: death-details;
width: 280px;
height: 65px;
border-style:ridge;
border-width: 2.5px;
border-radius: 5px
}
.item9
{
grid-area: children;
width: 700px;
height: 35px;
margin-right: auto;
margin-left: auto;
border-style:ridge;
border-width: 2.5px;
border-radius: 5px
}
.item10
{
grid-area: bio;
width: 700px;
height: 95px;
margin-right: auto;
margin-left: auto;
border-style:ridge;
border-width: 2.5px;
border-radius: 5px
}
.item11
{
grid-area: thumbnails;
width: 700px;
height: 55px;
margin-left: auto;
margin-right: auto;
margin-left: auto;
border-style:ridge;
border-width: 2.5px;
border-radius: 5px
}
.grid-container
{
display: grid;
background-color: rgb(234, 217, 201);
margin-left: auto;
margin-right: auto;
border-style:ridge;
border-width: 3px;
border-radius:20px;
width: 860px;
height: 540px;
gap: 2px 1px;
grid-template-areas:
'name name name name name name'
'photo photo birth birth-details birth-details birth-details'
'photo photo marriage marriage-details marriage-details marriage-details'
'photo photo death death-details death-details death-details'
'bio bio bio bio bio bio'
'children children children children children children'
'thumbnails thumbnails thumbnails thumbnails thumbnails thumbnails';
}
.grid-container > div
{
background-color: rgba(255, 255, 255, 0.8);
text-align: left;
padding-left: 9px;
padding-top: 1px;
font-size: 11px;
}
.name
{
display: grid;
width: 600px;
height: 30px;
margin-top: 5px;
margin-bottom: 8px;
border-style: ridge;
border-width: 6px;
border-radius: 5px;
background-color: #fff;
}
div .name
{
text-align: center;
font-size: 16px;
}
.photo
{
display: grid;
margin-bottom: 1px;
width: 225px;
height: 225px;
border-style:ridge;
border-radius: 5px;
border-width: 2.5px;
background-color: #fff;
}
.birth-legend
{
display: grid;
width: 75px;
height: 60 px;
}
.birth-details
{
display: grid;
width: 300px;
height: 60px;
margin-left: 290px;
margin-bottom: 1px;
border-style: ridge;
border-radius: 1px;
border-width: 2px;
background-color: #fff;
padding-left: 5px;
padding-bottom: 2px;
text-align: center;
}
.marriage-legend
{
display: grid;
width: 75px;
height: 60;
margin-left: 295px;
}
.marriage
{
display: grid;
margin-left: 290px;
margin-bottom: 1px;
width: 400px;
height: 60px;
border-style: ridge;
border-radius: 2px;
border-width: 2px;
background-color: #fff;
padding-left: 5px;
padding-top: 2px;
}
.death-legend
{
display: grid;
width: 75px;
height: 60px
margin-left: 295px;
}
.death
{
display: grid;
margin-left: 290px;
margin-bottom: 1px;
width: 400px;
height: 60px;
border-style: ridge;
border-radius: 2px;
border-width: 2px;
background-color: #fff;
padding-left: 5px;
padding-top: 2px;
}
.bio
{
display: grid;
margin-bottom: 3px;
width: 730px;
height: 60px;
border-style: ridge;
border-radius: 2px;
border-width: 2px;
background-color: #fff;
padding-left: 5px;
padding-top: 2px;
}
.children
{
display: grid;
margin-bottom: 3px;
width: 730px;
height: 60px;
border-style: ridge;
border-radius: 2px;
border-width: 2px;
background-color: #fff;
padding-left: 5px;
padding-top: 2px;
}
.thumbnails
{
display: grid;
margin-bottom: 1px;
width: 730px;
height: 60px;
border-style: ridge;
border-radius: 2px;
border-width: 2px;
background-color: #fff;
padding-left: 5px;
padding-top: 2px;
}
HTML Code
Code:
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta http-equiv="content-type" content="text/html"
charset=UTF-8>
<link rel="stylesheet" type="text/css"
href="styles.css" media="screen" />
<title="the-clan">GRID</title>
</head>
</head>
<body>
<div class="grid-container">
<div class="item1">Name</div>
<div class="item2">Photo</div>
<div class="item3">Birth</div>
<div class="item4">Date:<br>
Place:<br>
Mother:<br>
Father:</div>
<div class="item5">Marriage</div>
<div class="item6">Spouse:<br>
Date:<br>
Place:</div>
<div class="item7">Death</div>
<div class="item8">Date:<br>
Place:<br>
Burial: </div>
<div class="item9">Children:</div>
<div class="item10">Bio: </div>
<div class="item11">Thumbnails:</div>
</div>
</body>
</html>
If I failed to post the code correctly, please tell me what I did wrong so I don't make that mistake again.
TIA
