Arranging li elements using grid placement

I'm facing some difficulty with aligning my li elements properly within rows. Despite trying various approaches, including using nth-child selectors and IDs for testing purposes, I am still unable to resolve the issue as expected.

#section2 {
  width: 50%;
}

#sec2grid {
  display: grid;
  grid-template-columns: 30% 70%;
  grid-template-rows: repeat(6, 17%);
}

#section2 ul {
  list-style: none;
}

#section2 li {
  margin-top: 30px;
  font-size: var(--text);
  font-weight: bold;
}

#sec2grid img:nth-child(1) {
  grid-column-start: 1;
  grid-row-start: 1;
}

#sec2grid img:nth-child(2) {
  grid-column-start: 1;
  grid-row-start: 2;
}

#sec2grid img:nth-child(3) {
  grid-column-start: 1;
  grid-row-start: 3;
}

#sec2grid img:nth-child(4) {
  grid-column-start: 1;
  grid-row-start: 4;
}

#sec2grid img:nth-child(5) {
  grid-column-start: 1;
  grid-row-start: 5;
}

#sec2grid img:nth-child(6) {
  grid-column-start: 1;
  grid-row-start: 6;
}

#sec2li1 {
  grid-column-start: 2;
  grid-row: 1 / 1;
}

#sec2li2 {
  grid-column-start: 2;
  grid-row: 2 / 2;
}

#sec2li3 {
  grid-column-start: 2;
  grid-row: 3 / 3;
}

#sec2li4 {
  grid-column-start: 2;
  grid-row: 4 / 4;
}

#sec2li5 {
  grid-column-start: 2;
  grid-row: 5 / 5;
}

#sec2li6 {
  grid-column-start: 2;
  grid-row: 6 / 6;
}
<section id="section2">
  <h2>How to Place<br>an Order?</h2>
  <div class="separator"></div>
  <div id="sec2grid">
    <img src="style/img/1.svg">
    <img src="style/img/2.svg">
    <img src="style/img/3.svg">
    <img src="style/img/4.svg">
    <img src="style/img/5.svg">
    <img src="style/img/6.svg">
    <ul>
      <li id="sec2li1"><span class="colorGreen">Contact </span>our team, present your requirements.</li>
      <li id="sec2li2">A dedicated representative reviews your request, offers a <span class="colorGreen">selection of suitable products</span>and sources equipment from our network of certified partners.</li>
      <li id="sec2li3">Choose your warranty:<span class="colorGreen"> 12 months or 24 months<<br></li>
      <li id="sec2li4">We provide you with an estimate, <span class="colorGreen">you confirm your order</span><</li>;
      <li id="sec2li5">On average in 5 business days, <span class="colorGreen">your order will be shipped to you<</span>/></li>;.
      <li id="sec2li6">Guaranteed <span class="colorGreen">Customer Support</span> by the team.</li>
    </ul>
  </div>
</section>

Appreciate any assistance you can offer.

Answer №1

One oversight I made was forgetting to specify the height for my "li" element. Implementing this adjustment resolved all issues.

#section2 li{
margin-top: 30px;
font-size: var(--text);
font-weight: bold;
width: 100%;
height: 100%;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is it possible to maintain a div consistently visible at the top while scrolling using CSS?

Is there a way to ensure that a div remains visible at the top of the page when scrolling without using jQuery, but only using CSS? ...

Arrange list items in alignment without the need for additional CSS (bootstrap) styling

<div class="card-body p-0"> <ul class="list-group list-group-flush"> <li class="list-group-item d-flex justify-content-between" th:each="extraConfig : ${extraConfigsPage.content}"> ...

Linking multiple font files of the identical typeface to their respective CSS styles

I recently purchased the Didot font from myfonts.com, which includes different styles such as regular, bold, italics, and bold italics (each in separate files). While using WordPress, I noticed that when my users write articles with bold and italic text, ...

Elegant rounded bordered sidebar design to highlight selected navigation items using HTML and CSS

I am looking to replicate the sidebar design displayed in the image below by using HTML and CSS. While I have successfully rounded the borders on the left side of a selected link, I am stuck when it comes to rounding the borders on the right side. https:/ ...

What could be causing the issue of my p tag not being centered within both of my content divs?

I'm struggling to center the paragraphs within the divs with classes .content1 and .content2. Can anyone help me figure out why? Check out the demo here Here is the code: .content1 p, .content2 p { text-align: center; background-color: rgba ...

Creating a dynamic container with a square element and text inside: Steps to achieve a responsive design

In the code below, I am creating a responsive 'rectangle' and 'square', along with making the text inside the p tag responsive. #rectangle { display: flex; width: 500px; height: 150px; background-color: brown; } ...

How to Convert Pixel Units to Rem and Em in CSS?

Until recently, I developed my website exclusively using pixels, which has made it less responsive than I'd like. Is there a method to efficiently convert pixel measurements to rem/em units, allowing for quicker and easier modifications? ...

Obtain the value of the background image's URL

Is there a way to extract the value of the background-image URL that is set directly in the element tag using inline styling? <a style="background-image: url(https:// ....)"></a> I attempted to retrieve this information using var url = $(thi ...

Switch the toggle to activate or deactivate links

My attempt at coding a switch to disable and enable links using CSS is functional in terms of JavaScript, but the appearance is not changing. I am lacking experience in this area. Here is my HTML Button code: <label class="switch" isValue="0"> ...

jQuery plugin: Dynamic text rotator with color transitions

For more information about the jQuery plugin, visit this page: https://github.com/peachananr/simple-text-rotator Here's a link to my Fiddle: https://jsfiddle.net/jzhang172/8msf91wa/ Make sure to check out my external Fiddle link, as the code here ma ...

Non Rectangular Header with Bootstrap's Responsive Navbar

Currently, I'm in the process of developing a website and I've been pondering if it's feasible to design a bootstrap navbar with a uniquely shaped header as a background. I envision the header to resemble something like this: https://i.sst ...

The style of the button label does not persist when onChange occurs

Encountered an interesting issue here. There is a button designed for selection purposes, similar to a select item. Here's the code snippet: <button class="btn btn-primary dropdown-toggle" style="width: 166%;" type="button" id="dropdownMe ...

Align both vertically and horizontally in the center of the body

I have two images aligned vertically inside a wrapper. How do I center the wrapper within the body? What is the best way to center my wrapper inside the body? <!DOCTYPE html> <html lang="en-US"> <head> <meta charset="utf-8"> ...

On medium screens, Bootstrap 5's layout transforms five equal columns into two rows that are centered on the page

Looking to achieve a layout where, on desktop sizes, I have 5 equal-width columns spaced evenly. When viewed on mobile, it should break down to 1 column. And on medium sizes, I want it to break down into two rows with the bottom row evenly spaced and cente ...

Issue with custom checkbox styling not responding to label hover and click functionality

I recently found a creative way to design custom styled checkboxes using pure CSS. The only downside is that you have to click on the box (actually, the label) itself to check it. If you're familiar with placing the input inside the label, then you kn ...

Position a div element after another using the :after pseudo-element

My goal is simple to explain, but I have exhausted all my efforts trying to achieve it. I am hoping for the ★ symbol to appear immediately after the number 06 using jQuery. Any assistance would be greatly appreciated. The numbers are generated by a s ...

Is there a way to dynamically change the title of a tab when new content is added to a minimized page?

Is anyone familiar with how websites like Facebook and Buzzfeed update their tab titles when there are multiple tabs open? I have noticed that sometimes they add a "(1)" or "(2)" to indicate changes on the page. Do they use JavaScript to achieve this eff ...

The glyphicons in Bootstrap are not appearing

My angular app is built using bulp angular and the component. I incorporate Sass (Node) into the project. I decided to switch to the flatly theme, which I downloaded from the bootswatch website and inserted it into _bootstrap.scss. // Core variables a ...

CSS HTML parent div cannot contain image properly

Creating a website using Bootstrap: <div class="row padding_zero"> <div class="col section px-0"> <img class="img-trans padding_zero" src="./svg/clouds-00.svg" style="margin-top: -150px& ...

What is the best way to add a CSS rule to JavaScript?

animation: scaleUp 0.3s linear 0.4s forwards; animation: scaleDown 0.3s linear forwards; Greetings! I'm currently working on adding animations to my content filtering functionality. Specifically, I want to incorporate the aforementioned CSS rules in ...