What's the best way to ensure these have equal heights?

There seems to be a difference in height between the verses at the bottom, and I want each verse next to each other to have equal heights. Here is my current code setup:

.verse img {
  height: 1em;
}
<h1>PSALM 1</h1>
<p>
  <div>
    <span class="verse" style="float:left; margin:auto; width:50%">
Beatus vir qui non abiit in consilio imporium, et in via peccatorum non stetit, et in cathedra pestilentiae non sedit.<br><br>
sed in lege Domini voluntas ejus, et in lege ejus meditabitur die ac nocte.<br><br>
Et erit tamquam lignum quod plantatum est secus decursus aquarum, quod fructum suum dabit in tempore suo: et folium ejus non defluet; et omnia quaecumque faciet prosperabuntur.<br><br>
Non sic impii, non sic; sed tamquam pulvis quem projicit ventus a facie terrae.<br><br>
Ideo non resurgent impii in judicio, neque peccatores in concilio justorum:<br><br>
quoniam novit Dominus viam justorum, et inter imporium peribit.</span>

    <span class="verse" style="float:right; position:inline-block; width:50%">
Blessed is he who does not walk in the counsel of the wicked, nor stand in the way of sinners, nor sit in the seat of scorners.<br><br>
But his delight is in the law of the <img src="/images/THE LORD.png">, and on His law he meditates day and night.<br><br>
He will be like a tree planted near good waters; he will bring good fruit in his season, and everything he does will prosper.<br><br>
Not so with the wicked! Not so... they are like chaff that the wind blows away.<br><br>
Therefore, the wicked will not stand in judgement, nor in the company of the just.<br><br>
For the <img src="/images/THE LORD.png"/> watches over the way of the just, but the way of the wicked leads to destruction.
</span>
  </div>

Answer №1

There are numerous style and semantic issues that need attention.

  • float should only be used to float elements within a text block, like an image in a newspaper article. It is not meant for design purposes or aligning elements next to each other!
  • <br> is specifically for line breaks to move the next word/letter to a new line. It is not intended for creating spacings or for design purposes - use margins, padding, or gaps instead.
  • Using a <p> tag for a single text block is more appropriate than using a div and breaking text with <br>s consecutively. Use multiple paragraphs when necessary.
  • Avoid mixing inline styles with external CSS for better organization.

Focusing on the issue:

When translating paragraph by paragraph, consider using a table for tabular data instead of structuring it differently. Here's an example:

.verse img {
  height: 1em;
}

table {
  width: 100%;
}

td {
  width: 50%;
  padding: 1em;
}
<h1>PSALM 1</h1>
<table>
  <tr>
    <td>Beatus vir qui non abiit in consilio imporium, et in via peccatorum non stetit, et in cathedra pestilentiae non sedit.</td>
    <td>Blessed is he who does not walk in the counsel of the wicked, nor stand in the way of sinners, nor sit in the seat of scorners.</td>
  </tr>
  <tr>
    <td>sed in lege Domini voluntas ejus, et in lege ejus meditabitur die ac nocte.</td>
    <td>But his delight is in the law of the <img src="/images/THE LORD.png">, and on His law he meditates day and night.</td>
  </tr>
  <tr>
    <td>Et erit tamquam lignum quod plantatum est secus decursus aquarum, quod fructum suum dabit in tempore suo: et folium ejus non defluet; et omnia quaecumque faciet prosperabuntur.</td>
    <td>He will be like a tree planted near good waters; he will bring good fruit in his season, and everything he does will prosper</td>
  </tr>
  <tr>
    <td>Non sic impii, non sic; sed tamquam pulvis quem projicit ventus a facie terrae.</td>
    <td>Not so with the wicked! Not so... they are like chaff that the wind blows away.</td>
  </tr>
  <tr>
    <td>Ideo non resurgent impii in judicio, neque peccatores in concilio justorum:</td>
    <td>Therefore, the wicked will not stand in judgment, nor in the company of the just.</td>
  </tr>
  <tr>
    <td>quoniam novit Dominus viam justorum, et inter imporium peribit.</td>
    <td>For the <img src="/images/THE LORD.png"/> watches over the way of the just, but the way of the wicked leads to destruction.</td>
  </tr>
</table>

An alternative visual approach could involve using CSS-Grid, although this might not be semantically correct, especially for screen-readers:

.verse img {
  height: 1em;
}

section {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-gap: 2em;
}
<h1>PSALM 1</h1>
<section>
  <p data-lang="latin">
    Beatus vir qui non abiit in consilio imporium, et in via peccatorum non stetit, et in cathedra pestilentiae non sedit.
  </p>
  <p data-lang="english">
    Blessed is he who does not walk in the counsel of the wicked, nor stand in the way of sinners, nor sit in the seat of scorners.
  </p>

  <p data-lang="latin">
    sed in lege Domini voluntas ejus, et in lege ejus meditabitur die ac nocte.
  </p>
  <p data-lang="english">
    But his delight is in the law of the <img src="/images/THE LORD.png">, and on His law he meditates day and night.
  </p>

  <p data-lang="latin">
    Et erit tamquam lignum quod plantatum est secus decursus aquarum, quod fructum suum dabit in tempore suo: et folium ejus non defluet; 
    et omnia quaecumque faciet prosperabuntur.
  </p>
  <p data-lang="english">
    He will be like a tree planted near good waters; he will bring good fruit in his season, and everything he does will prosper
  </p>

  <p data-lang="latin">
    Non sic impii, non sic; sed tamquam pulvis quem projicit ventus a facie terrae.
  </p>
  <p data-lang="english">
    Not so with the wicked! Not so... they are like chaff that the wind blows away.
  </p>

  <p data-lang="latin">
    Ideo non resurgent impii in judicio, neque peccatores in concilio justorum:
  </p>
  <p data-lang="english">
    Therefore, the wicked will not stand in judgment, nor in the company of the just.
  </p>

  <p data-lang="latin">
    quoniam novit Dominus viam justorum, et inter imporium peribit.
  </p>
  <p data-lang="english">
    For the <img src="/images/THE LORD.png"> watches over the way...
  </p>
</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

- Customizing the width of each dropdown level in a unique way

Working on a customized menu design that you can view live at: Focusing on the third level menu, I encountered an issue where all menus have the same width due to sharing the dropdown-menu class. While I understand the root cause of the problem, I am unsu ...

Using the ID selector to create a media query

My website is live, and I'm working on making it mobile-friendly. Most of the site works well on mobile, but I'm having trouble centering a jquery lightbox function using media queries. I'm not sure if my syntax is wrong or if there's a ...

Incorporate pug and sass into your React project for a more

Are pug/jade and sass compatible with react? I enjoy organizing my code by separating files, and the functionality that sass and pug provide is great for this purpose. Is there a way to integrate pug and sass into a react project? Pug example: doctype ...

Customize Individual Rows in a React DataGrid

I am exploring the world of Material UI React data grid for the first time, and I am looking to add a unique background color to only the initial three rows. Each row should have a different color scheme that remains static, without any interactions trigge ...

Building a single-page app optimized for mobile viewing with Foundation framework

Currently facing an issue with the scaling of the viewport on certain mobile devices when loading new content via ng-include in our responsive website built on Foundation. The problem arises as the width of the page breaks, leading to horizontal scrolling. ...

Error in NodeJS (EJS): Unable to locate stylesheet file

Having trouble adding a CSS file to my Node.js project with the EJS Template Engine. The file cannot be found when trying to access it. GET http://localhost/css/bulma.css net::ERR_ABORTED 404 (Not Found) Project folder structure ./index.js ./views ...

Showing XML content with JavaScript

Trying to parse a simple XML list using JavaScript, but having trouble formatting it the way I need. <TOURS> <MONTH> <TOUR> <NUMBER>1</NUMBER> <VENUE>City Name - Venue Name</VENUE> < ...

Preventing jQuery slideToggle functionality from toggling multiple elements at once

I am currently working on a project where I have a series of images with captions that appear underneath each one. To show or hide the caption for each image, I am using slideToggle when the image is clicked. $('.imageholder').click(function() ...

Is the text in the React chat application too lengthy causing a bug problem?

In my chat application built with React, I am facing an issue where if a user types more than 100 characters, the message gets cut off. How can I fix this problem? Please refer to the image below for reference. https://i.sstatic.net/DLNyH.png {Object.keys ...

What strategies can I use to divide lengthy words in my Django application?

My username on the site is causing overflow outside of the content box, as shown here I tried adding h1, h2, h3, h4, h5, h6 { color: #44444; overflow-wrap: break-word;}, but it didn't work. Here is the code for the profile page: All CSS styles for ...

Animating back with a jQuery if statement

Is there a way to implement an if statement that triggers an animation when the right image reaches +400px, and then animates back to -400px upon hovering over the image? $('#left img').mouseenter(function() { $('#right img').animate ...

Achieving a layout of three columns and two rows (1 x 2 x 2) using flexbox

I am looking to achieve a specific layout using Flexbox. While I am comfortable with CSS, I want to challenge myself by learning how to implement this design using Flexbox for more concise and maintainable code. https://i.stack.imgur.com/QDVfT.png .ban ...

The problem of a static click function not working when clicked on a link. What is the solution for this

Details I am currently using a flickity slideshow that automatically goes to the next picture on a click. Within the slideshow, I have placed a button with text and a link to an external website (e.g. ). My Problem: When I click on the link, my slidesho ...

Differences in row padding when transitioning from Bootstrap 3 to Bootstrap 4

One thing I've noticed is that when utilizing Bootstrap 3, the use of div.row would automatically create a vertical spacing between rows which was quite appealing. However, upon transitioning to Bootstrap 4, this automatic spacing seemed to disappear. ...

Center align `div 1` with CSS and right align `div 2`

Take a look at this code snippet: http://jsfiddle.net/zygnz/1/ <div class="container"> <div class="left"> LEFT </div> <div class="right"> RIGHT </div> </div> Is i ...

Enhancing the appearance of h3 headings using CSS without changing the HTML code

I'm looking to add some style to the h2 elements on my website. Here is an example of a website where I like the styling: Another reference site for comparison is: If you look at the first h3 heading that reads "Head To Head Comparison Between Merge ...

The dimensions of my textarea and input field are different

Just starting out with HTML and CSS here. I'm trying to use flexbox to create a form, but the width of my input fields and text area is off for some reason. Any ideas on what might be missing from my code? Thanks in advance! Here's the CSS I&apo ...

Dealing with h2 text overflowing within a bordered container

I need help creating an h2 element with a double border. Here is my current HTML+CSS snippet: h2.titulo { width: 100%; margin: 10px 0; padding: 10px 0; text-transform: uppercase; font-weight: 400; font-size: 30px; display: block; color: ...

styling multiple elements using javascript

Recently, I created a jQuery library for managing spacing (margin and padding). Now, I am looking to convert this library to pure JavaScript with your assistance :) Below is the JavaScript code snippet: // Useful Variables let dataAttr = "[data-m], [d ...

Crafting web design with media queries to ensure responsiveness

I have been working on creating a responsive webpage. While the header and footer are resizing properly when the browser is reduced in size, the navigation section is not behaving the same way. Currently, shrinking the page is causing the navigation block ...