When there is only one line of text, the alignment of the CSS content is not displayed

I have a code snippet below. It's functioning well, except for when the browser window is wide enough that the text fits in just one line, the "posts" become misaligned.

For example:

https://i.sstatic.net/feJjLH6t.png

I've tried tweaking the CSS but can't seem to get it aligned properly. Thank you in advance for any help!

Link to jsfiddle: https://jsfiddle.net/BHolm/n68r5xst/167/

/*Feed*/
 
.feed-row {
  padding-bottom: 40px;
  padding-right: 20px;
}

.feed-mt .post-submitted-info {  
  font-weight: 700; 
  text-align: center; 
  line-height: 1; 
  position: relative; 
   
}

.post-submitted-info { 
  column-width: 55px; 
  margin-left: 10px;
}

.submitted-date { 
  border-right: 1px solid #c2c2c2; 
}

.submitted-date { 
  margin-top: 12px; 
}

.post-submitted-info .year { 
  padding-bottom: 8px 
}

.post-submitted-info .month, .post-submitted-info .year {  
  font-size: 14px; 
  text-transform: uppercase; 
}

.feed-mt .post-submitted-info .day { 
  font-size: 29px; 
  font-weight: 900; 
  padding-bottom: 2px; 
}

.feed-main-content {
  padding-left: 75px;
  margin-top: -75px;
}

.field-item{  
  font-weight: normal;
  border-bottom: 1px solid #acacac;
  
}

.feed-main-content .header {
    
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="86e4e9e9f2f5f2f4e7f6c6b2a8b5a8b7">[email protected]</a>/dist/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

<!-- Load Handlebars.js from Unpkg. -->
<script src="https://unpkg.com/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9bf3faf5fff7fef9fae9e8dbafb5aeb5ab">[email protected]</a>/dist/handlebars.min.js"></script>

<!-- Load jQuery and Sheetrock from Unpkg -->
<script src="https://unpkg.com/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="92f8e3e7f7e0ebd2a1bca4bca2">[email protected]</a>/dist/jquery.slim.min.js"></script>
<script src="https://unpkg.com/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7e0d161b1b0a0c111d153e4f504c504e">[email protected]</a>/dist/sheetrock.min.js"></script>
<body>
  <div id="hf">
    <script id="hf-template" type="text/x-handlebars-template">

<!-- Post Date Section -->
      <div class="row feed-row feed-mt">
        <div class="post-submitted-info">
            <div class="submitted-date">
            <div class="month">{{cells.Month}}</div>
            <div class="day">{{cells.Day}}</div>
            <div class="year">{{cells.Year}}</div>         
            </div>
        </div>
        
<!-- Post Content Section -->
        <div class="feed-main-content">
            <div class="header">
            <h2>{{cells.Header}}</h2>
          </div>
            <div class="field-item">
            <p>{{cells.Content}}</p>
            </div>
        </div>
      </div>
    </script>
  </div>
</body>

Answer №1

The issue stemmed from the negative top margin you applied.

/*Feed*/
.feed-mt{
  display:flex;
  gap:10px
}
 
.feed-row {
  padding-bottom: 40px;
  padding-right: 20px;
}

.feed-mt .post-submitted-info {  
  font-weight: 700; 
  text-align: center; 
  line-height: 1; 
  position: relative; 
   
}

.post-submitted-info { 
  column-width: 55px; 
  margin-left: 10px;
}

.submitted-date { 
  border-right: 1px solid #c2c2c2; 
}

.submitted-date { 
  margin-top: 12px; 
  width:60px;
}

.post-submitted-info .year { 
  padding-bottom: 8px 
}

.post-submitted-info .month, .post-submitted-info .year {  
  font-size: 14px; 
  text-transform: uppercase; 
}

.feed-mt .post-submitted-info .day { 
  font-size: 29px; 
  font-weight: 900; 
  padding-bottom: 2px; 
}

.feed-main-content {
  display:flex;
  flex-direction:column;
  align-items:start;
  width:calc(100% - 100px);
}

.field-item{  
  font-weight: normal;
  border-bottom: 1px solid #acacac;
}

.feed-main-content .header {
    
}

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

Delete an item upon hover-out using HTML and CSS

Currently, I am in the process of developing a website that features a dropdown menu. I would like it so that when you click on the menu, it appears, but if you move your cursor away from it, it disappears until you click on it again. Below is the HTML ...

Tips for setting up the image as the header background in HTML5 and CSS3

I am currently designing a website. I'm wondering if there is a way to create a div with a curved bottom using HTML5, CSS3 and JavaScript. It should resemble the design of the curved header bottom ...

Connect a search function to a specific column in jQuery Datatables

Currently utilizing jQuery Data tables for a project. Looking to incorporate select boxes in one of the columns, with the actual cell value pre-selected. Is there a method to link a lookup table to this column, so each cell is connected to the lookup tab ...

Blending images together can obscure surrounding elements

Is there a way to make two images crossfade on hover without hiding the text underneath? I need the text to show below the image, not behind it. Any suggestions on how to solve this issue? #center { text-align: center; } #under { text-align: cente ...

How to use Angular ngRepeat to create multiple select fields that do not show previously selected data with ng-options

Looking at the issue from a high level; I'm fetching data from an api and creating a CRUD page for it. The user can choose from a set of labels provided in the data. Here is a code snippet illustrating my dilemma. The selected labels are denoted by t ...

Learn techniques for recognizing React components by utilizing the inInView hook and transmitting their values to a child component

Currently, I am working on creating a navigation bar using React that dynamically highlights the active component when it is scrolled into view by the user. For example, if the user scrolls to the 'About' section, the user icon should be highligh ...

Is there a way to display a React component containing an array that is constantly changing due to an external function?

I am facing a challenge involving a component that needs to render an array of divs. The requirement is to add another div after a certain external function is triggered. This function must be declared outside the component for export purposes. The issue ...

Extracting information from Mysql database and saving it in the option html element

Hi everyone, I'm facing a problem with a question. My goal is to fetch data from MYSQL and save it in an option tag. Below is my code snippet. <?php $user = "admin"; $password = ""; $db = "test"; $host = "localhost"; $cxn = mysqli_connect($host, $ ...

Which is more secure for handling data from the same server, JSON.parse() or eval()?

While it's commonly understood that JSON.parse() helps prevent attackers from injecting JavaScript into responses, this question delves into a different aspect. If an attacker manages to hijack your Ajax call and insert JavaScript, wouldn't they ...

Cutting an in-memory Base64 PNG using ONLY JavaScript on the client side without relying on canvas

Scenario: Working with JavaScript in a SDK environment, either on node.js or a browser. Situation: I have a base64 string containing a PNG image encoded using base64 (extracted from selenium webdriver's takeScreenshot function). Inquiry: How can I c ...

Confirmation dialog with user-defined button text

When the confirm prompt box is used, it typically displays "ok" and "cancel" buttons. I am looking to customize the label text for the buttons to read as Agree and Not Agree instead. If you have any suggestions on how to achieve this modification, please ...

Height setting for an ASP.NET UpdateProgress widget

In my ASP.NET Project, I am facing an issue with the UpdateProgress. I need the UpdateProgress to adjust its height dynamically based on the content within the UpdatePanel. I attempted to use a JQuery script to accomplish this, but the script does not run ...

Retrieve the most recent score of authorized players using the Google Game API and Node.js

How can I display the last score of a specific game using the Google Play Game API? For example, I am looking to retrieve the latest scores of authenticated users playing "Rush Fight" with NodeJS. Any suggestions on how to achieve this? ...

fetch promise not fulfilling as expected

There's a method I'm using to call an all-purpose fetch method defined in a separate JS file: export function detailedView(request,token) { let endpoint = 'api/v1/cbn/inventory/GetDetailRequest?RequestNo='+request['RequestNo&a ...

Accordion border in Bootstrap should be applied to all items except the first one

I am currently implementing Bootstrap accordions in an Angular application and I am facing an issue where I want to have a colored border all around each accordion panel. The problem is that by default, Bootstrap removes the top border from all accordions ...

I'm looking for the best way to send POST data to an API with Meteor's HTTP package

Here's my current code snippet: HTTP.post("http://httpbin.org/post", {}, function(error, results) { if (results) { console.log(results); } else { console.log(error) } ...

How can the values from the scale [-60, -30, -10, 0, 3, 6, 10] be converted to a decimal range of 0-1 through

Thank you for helping me with so many of my issues. <3 I'm certain that someone has already solved this, but I'm unsure of the specific mathematical term (I've attempted reverse interpolation and others, but with no luck) so I am present ...

Is it possible to develop Hybrid Apps specifically for Windows Tablets/Surface devices?

We have created a Hybrid App for Android devices and made it compatible with Windows by using Adobe PhoneGap Build to generate a .XAP package from the existing Source Code. We believe that this .XAP package can easily be deployed on a Windows Mobile devic ...

File not found - please check the required file paths

How do I resolve the address issue within the "require" function in my PHP code? I am receiving an error message that reads: Warning: require (..) failed to open stream: no such file or directory. https://i.sstatic.net/OQvQ6.jpg https://i.sstatic.net/pIR ...

Utilizing JodaTime with JavaScript (AngularJS): A Comprehensive Guide

I am utilizing DateTime to create Date objects and sending them as JSON to the UI. How can I work with this in JavaScript (specifically AngularJS) and convert it back and forth? For instance, if I need the user to update the time, I should be able to retr ...