An even flexbox grid featuring content of varying sizes and dividers

I am currently in the process of working on a .psd template and utilizing Bootstrap 4. I have encountered an issue with one section that contains multiple rows and columns with varying content. The main problem is with one column where the text inside the header wraps into two lines. How can I center the other headers, which are only one-lined, in relation to this particular column?

Here is an image showing the section from the mockup

Another question I have pertains to dividers. What is the better option for inserting them as shown in the mockup? Should I use before/after?

Thank you.

.benefites {
  background: #0b3b52;
}

.benefites .headline {
  color: #fff;
  padding: 30px 0;
  font-weight: 100;
  text-transform: uppercase;
}

.benefites h4,
.benefites h2 {
  color: #92d050;
}

.benefites p {
  color: #fff;
}

.benefites .block {
  align-self: center;
}

.benefites img {margin: 10px 0;}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />

<section class="benefites">
  <div class="container">
    <div class="row">
      <div class="col-md-12 text-center">
        <h2 class="headline">Managing your team has never been easier!
        </h2>
      </div>
    </div>
    <div class="row text-center">
      <div class="col-md-3 block">
        <h4>Players</h4>
        <img src="http://i.piccy.info/i9/f69f598e82ca5dd1e1603b1cc86cc39f/1517595403/422/1218424/icons.png" alt="">
        <p>Manage team roster and member profiles easily with our amazing tool</p>
      </div>
      <div class="col-md-3">
        <h4>Players</h4>
        <img src="http://i.piccy.info/i9/f69f598e82ca5dd1e1603b1cc86cc39f/1517595403/422/1218424/icons.png" alt="">
        <p>Save time and energy! Manage all your teams in one easy-to-use platform </p>
      </div>
      <div class="col-md-3">
        <h4>Practises & Games</h4>
        <img src="http://i.piccy.info/i9/f69f598e82ca5dd1e1603b1cc86cc39f/1517595403/422/1218424/icons.png" alt="">
        <p> Figuring out the “when and where” has never been easier. Schedule your games, practices, quickly and easily!</p>
      </div>
      <div class="col-md-3">
        <h4>Injuries & Medical records</h4>
        <img src="http://i.piccy.info/i9/f69f598e82ca5dd1e1603b1cc86cc39f/1517595403/422/1218424/icons.png" alt="">
        <p>Collect all the data about your player’s condition and medical records</p>
      </div>
      <div class="w-100"></div>
      <div class="col-md-3">
        <h4>Sponsors & Agents</h4>
        <img src="http://i.piccy.info/i9/f69f598e82ca5dd1e1603b1cc86cc39f/1517595403/422/1218424/icons.png" alt="">
        <p>Manage all the sponsor and agent information with us </p>
      </div>
      <div class="col-md-3">
        <h4>Contacts</h4>
        <img src="http://i.piccy.info/i9/f69f598e82ca5dd1e1603b1cc86cc39f/1517595403/422/1218424/icons.png" alt="">
        <p>A full contact database that makes you easy to search, filter, and update</p>
      </div>
      <div class="col-md-3">
        <h4>Contracts</h4>
        <img src="http://i.piccy.info/i9/f69f598e82ca5dd1e1603b1cc86cc39f/1517595403/422/1218424/icons.png" alt="">
        <p>Get full visibility and handle all the contracts online with CRM42</p>
      </div>
      <div class="col-md-3">
        <h4>Reports</h4>
        <img src="http://i.piccy.info/i9/f69f598e82ca5dd1e1603b1cc86cc39f/1517595403/422/1218424/icons.png" alt="">
        <p>Our wide range of reports help you to take your management skills to a next level</p>
      </div>
      <div class="w-100"></div>
      <div class="col-md-3">
        <h4>Treatments</h4>
        <img src="http://i.piccy.info/i9/f69f598e82ca5dd1e1603b1cc86cc39f/1517595403/422/1218424/icons.png" alt="">
        <p>Simply the best tool for managing all kind of team payments</p>
      </div>
      <div class="col-md-6 block">
        <h2>
          And many more amazing features ...
        </h2>
      </div>
      <div class="col-md-3 ">
        <h4>Customized platfrom</h4>
        <img src="http://i.piccy.info/i9/f69f598e82ca5dd1e1603b1cc86cc39f/1517595403/422/1218424/icons.png" alt="">
        <p>Make the most out of your management tool. Create your own design quickly and easily.</p>
      </div>
    </div>
  </div>
</section>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" </script>
  < script src = "https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
</script>

Answer №1

To begin, eliminate block from the first <div class="col-md-3"> so that they all align at the top.

Next, since the h4 tags cannot see each other (as they are not siblings), you have two options: either assign them a fixed height (adjustable through media queries for different screen sizes) or use a script.

Below is an example using a fixed height approach, where I included this CSS rule:

.benefits h4 {
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
}

For another solution involving scripts and additional CSS tips, refer to my answer on how to get header from cards to have the same height with flexbox?.

Stack snippet

.benefits {
  background: #0b3b52;
}

.benefits .headline {
  color: #fff;
  padding: 30px 0;
  font-weight: 100;
  text-transform: uppercase;
}

.benefits h4,
.benefits h2 {
  color: #92d050;
}

.benefits h4 {
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.benefits p {
  color: #fff;
}

.benefits .block {
  align-self: center;
}

.benefits img {margin: 10px 0;}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />

<section class="benefits">
  <div class="container">
    <div class="row">
      <div class="col-md-12 text-center">
        <h2 class="headline">Managing your team has never been easier!
        </h2>
      </div>
    </div>
    <div class="row text-center">
      <div class="col-md-3">
        <h4>Players</h4>
        <img src="http://i.piccy.info/i9/f69f598e82ca5dd1e1603b1cc86cc39f/1517595403/422/1218424/icons.png" alt="">
        <p>Manage team roster and member profiles easily with our amazing tool</p>
      </div> 

      <!-- Additional HTML code removed for brevity -->

      <div class="col-md-6 block">
        <h2>
          And many more amazing features ...
        </h2>
      </div>
      <div class="col-md-3 ">
        <h4>Customized platform</h4>
        <img src="http://i.piccy.info/i9/f69f598e82ca5dd1e1603b1cc86cc39f/1517595403/422/1218424/icons.png" alt="">
        <p>Make the most out of your management tool. Create your own design quickly and easily.</p>
      </div>
    </div>
  </div>
</section>

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

Enlarge the DIV element along with its contents when those contents have absolute positioning

When attempting to overlay two divs like layers of content, I encountered a challenge. Because the size of the content is unknown, I used POSITION:ABSOLUTE for both divs to position them at the top left of their container. The issue: The container does no ...

The options that are not selected in a dropdown menu will not be added to a different dropdown menu

In my application, I have 2 select boxes. When the user submits the page, only the selected students in the first select box #studentadd are appended to the second select box #studentselect. However, the unselected options from #studentadd do not get appen ...

What is the process to replace the image in these templates?

I recently downloaded a template from the internet and am in the process of developing a website. Can someone please guide me on how to change the icons highlighted in the black and red boxes as shown in the image? I am using Visual Studio and ASP.NET fo ...

Styling Labels with CSS Wildcard

I have been using the free NinjaForms plugin on my WordPress site. The default styling for labels is bold, but I prefer them to be lighter. Currently, I achieve this through CSS by targeting individual field IDs. However, this method becomes tedious when a ...

When the input field is cleared, JavaScript will not be able to recognize its contents

Having an issue with my function that fetches results, <script language="javascript"> function fetchResult(value){ url="ajax_fetch.php?st=usr&q="+value; ajax(url); } fetchResult(" "); </script&g ...

Establish a background image that can be scrolled

Currently, I am working on a project and have created a fiddle that can be accessed here: https://jsfiddle.net/0g3u8452/1/ The image I am using is 1920x4000, and I want it to span the full width of the screen similar to setting background-size ...

Change from one value to another using a decaying sinusoidal wave

Can someone help me come up with a formula that will smoothly transition from a starting value to an end value over a specified time using a Sin or Cos wave? I'm attempting to replicate a bouncing effect like the one shown in my sample using CSS and ...

Why doesn't the z-index of child elements function properly when their fixed parents share the same z-index value?

I have utilized jsfiddle to replicate my problem. My goal is to position .top .inside above .bottom .inside. I am aware that z-index only functions within its respective position type, for example fixed and absolute do not share the same z-index level. How ...

CSS: Trouble with elements positioning

I am attempting to position two boxes on top of each other at the bottom of a different div. Here is the code I have: <div style = "height:400px;width:400px;border:1px solid #000;"> <div style = "position:relative;height:100px;width:100px;bor ...

Deleting a particular tag with regular expressions: a step-by-step guide

I'm attempting to remove a ul tag along with any nested tags inside it. <ul class="related"> <li><a href="/related-1.html" target="_blank">Related article</a></li> <li><a href="/related-2.html" target="_blank"&g ...

Prompting the website to 'refresh' and return to the beginning of the page

My website's functionality is closely tied to the user's position on the page. Different features are triggered once specific distances are reached. I am seeking a way for users to automatically return to the top of the page upon page reload. Cu ...

Unable to assign a value to the HTMLInputElement's property: The input field can only be set to a filename or an empty string programmatically

When attempting to upload an image, I encountered the error message listed in the question title: This is my template <input type="file" formControlName="avatar" accept=".jpg, .jpeg .svg" #fileInput (change)="uploa ...

Is there a solution to fix the issue with IE causing hover effects not to

I'm currently in the process of designing a website, and I have implemented some image hover effects that reveal elements within the image when you hover over it. These effects are functioning correctly on Chrome, Safari, and Firefox; however, they ar ...

Interactive Image Effects with Hover using HTML and JavaScript

I have observed that the transform works fine, but there is a slight issue when initially hovering or touching the image. After the first touch or hover, everything works great. Any assistance on fixing this minor issue would be greatly appreciated. Thank ...

What's the significance of the #/ symbol in a URL?

Currently, I am developing Ruby on Rails web applications. The URL of my webpage appears as follows: http://dev.ibiza.jp:3000/facebook/report?advertiser_id=2102#/dashboard From this link, I have identified that the advertiser_id is 2102 but I am unsure a ...

Displaying vertical content with a horizontal scroll using Bootstrap

I have created a div container and I would like to implement a horizontal scroll bar when there are more than four items (each item consists of a picture with a title). Desired outcome: https://i.sstatic.net/wWucQ.png The issue I am facing is that by usi ...

CSS Hover Effect Not Resizing Image

I've been struggling to incorporate a hover effect into my responsive image grid. I want the image to have a dark overlay and fade in some text when hovered over, but I can't seem to make it work. Take a look at my HTML structure: <div class ...

Customize div styles according to the website domain

I want to dynamically change the header of my website based on whether it is in dev QA or production environment. Below is the HTML code: <div id="wrapper"> <form id="form1" runat="server"> <div class="wrapper"> <div> ...

A hobby project involving the creation of a webmail app using a combination of PHP

As a beginner in web development, I am eager to tackle a hobby project that will help me learn more about PHP and other web-related technologies. I have been considering creating a simple webmail client, but I'm not sure where to begin. I anticipate ...

html issue with the footer

Just starting out with HTML and encountering some difficulties with adding a footer. The main issue is that when I add the footer, the 'form' element gets stretched all the way down until it reaches the footer - you can see an example of this her ...