I am trying to create a CSS grid. This is my HTML code:
<div id="updates" class ="wrapper">
<div id="content">
<section id="services" class="last clear">
<ul>
<li>
<article class="clear">
<figure><img src="images/demo/180x150.gif" alt="">
<figcaption>
<h2>Indonectetus facilis leo nibh</h2>
<p>content content content <a href="#" title="Free Website Templates">link to other content</a>. For full terms of use of this template please read our <a href="https://www.os-templates.com/template-terms">website template licence</a>.</p>
<footer class="more"><a href="#">Read More »</a></footer>
</figcaption>
</figure>
</article>
</li>
</ul>
</section>
</div>
<div id="content">
<section id="services" class="last clear">
<ul>
<li>
<article class="clear">
<figure><img src="images/demo/180x150.gif" alt="">
<figcaption>
<h2>Indonectetus facilis leo nibh</h2>
<p>content content content <a href="#" title="Free Website Templates">link to other content</a>. For full terms of use of this template please read our <a href="https://www.os-templates.com/template-terms">website template licence</a>.</p>
<footer class="more"><a href="#">Read More »</a></footer>
</figcaption>
</figure>
</article>
</li>
</ul>
</section>
</div>
My CSS file looks like this:
.wrapper{
height: 90vh;
margin: 2rem;
display: grid;
grid-template-columns: 1fr 1fr 1fr;
/* grid-template-rows: 1fr 1fr ; */
/* margin-top: 5%; */
/* margin-left: 15%; */
}
.wrapper > div {
padding:1em;
}
.updates, .updates a{color:#C0BAB6; background-color:#333333;}
#header, #updates, #footer{display:block; width:600px; margin:0 auto;}
body{margin:0; padding:0; font-size:13px; font-family:Georgia, "Times New Roman", Times, serif; color:#afaeae; background-color:#232323;}
address, article, aside, figcaption, figure, footer, header, nav, section{display:block; margin:0; padding:0;}
h1, h2, h3, h4, h5, h6{margin:0; padding:0; font-size:16px; font-weight:bold; font-style:normal; line-height:normal; text-transform:uppercase;}
.clear:after{content:"."; display:block; height:0; clear:both; visibility:hidden; line-height:0;}
.clear{display:block; clear:both;}
img{margin:0; padding:0; border:none; line-height:normal; vertical-align:middle;}
.imgholder, .imgl, .imgr{padding:4px; border:1px solid #D6D6D6; text-align:center;}
.imgl{float:left; margin:0 15px 15px 0; clear:left;}
.imgr{float:right; margin:0 0 15px 15px; clear:right;}
#updates #content #services{}
#updates #content #services ul{margin:0; padding:0; list-style:none;}
#updates #content #services ul li{display:block; width:100%; margin-bottom:30px;}
#updates #content #services ul li.last{ margin-bottom:0;}
#updates #content #services ul li article{}
#container #content #services ul li article figure{}
#updates #content #services ul li article figure img{float:left; width:180px; height:150px; margin:0; padding:4px;
border:1px solid #666666;}
#updates #content .more{
text-align:right;
}
This grid should be side by side. I did look at Firefox developer tab and it was saying overflow at updates id
I don't seem to understand why the the entire id=content is centered? Which is likely to cause the the overflow. I don't see any left-margin or padding which is causing the content to centered.
I used this:
.wrapper > div {
padding:1em;
}
Do I need to target a specific class content for it to work? Because it seems like grid on all div.
